Input unit: Generalizados los tipos de input. Ya no son específicos de cada juego
This commit is contained in:
16
main.cpp
16
main.cpp
@@ -93,10 +93,10 @@ int main(int argc, char *argv[])
|
||||
Input *input = new Input(asset->get("gamecontrollerdb.txt"));
|
||||
input->setVerbose(options->console);
|
||||
input->discoverGameController();
|
||||
input->bindKey(input_up, SDL_SCANCODE_UP);
|
||||
input->bindKey(input_down, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(input_left, SDL_SCANCODE_LEFT);
|
||||
input->bindKey(input_right, SDL_SCANCODE_RIGHT);
|
||||
input->bindKey(INPUT_UP, SDL_SCANCODE_UP);
|
||||
input->bindKey(INPUT_DOWN, SDL_SCANCODE_DOWN);
|
||||
input->bindKey(INPUT_LEFT, SDL_SCANCODE_LEFT);
|
||||
input->bindKey(INPUT_RIGHT, SDL_SCANCODE_RIGHT);
|
||||
|
||||
// Inicializa el texto
|
||||
Text *text = new Text(asset->get("smb2.txt"), asset->get("smb2.png"), renderer);
|
||||
@@ -156,19 +156,19 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
string inputPressed = "";
|
||||
if (input->checkInput(input_left))
|
||||
if (input->checkInput(INPUT_LEFT))
|
||||
{
|
||||
inputPressed = "LEFT";
|
||||
}
|
||||
if (input->checkInput(input_right))
|
||||
if (input->checkInput(INPUT_RIGHT))
|
||||
{
|
||||
inputPressed = "RIGHT";
|
||||
}
|
||||
if (input->checkInput(input_up))
|
||||
if (input->checkInput(INPUT_UP))
|
||||
{
|
||||
inputPressed = "UP";
|
||||
}
|
||||
if (input->checkInput(input_down))
|
||||
if (input->checkInput(INPUT_DOWN))
|
||||
{
|
||||
inputPressed = "DOWN";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user