working on game controller input

This commit is contained in:
2021-08-24 20:12:28 +02:00
parent bf45482c10
commit f9d6917770
2 changed files with 4 additions and 4 deletions

View File

@@ -191,16 +191,16 @@ bool Input::discoverGameController()
if (SDL_IsGameController(i)) if (SDL_IsGameController(i))
{ {
char *mapping; char *mapping;
SDL_Log("Index \'%i\' is a compatible controller, named \'%s\'", i, SDL_GameControllerNameForIndex(i)); printf("Index \'%i\' is a compatible controller, named \'%s\'", i, SDL_GameControllerNameForIndex(i));
mGameController = SDL_GameControllerOpen(i); mGameController = SDL_GameControllerOpen(i);
mapping = SDL_GameControllerMapping(mGameController); mapping = SDL_GameControllerMapping(mGameController);
SDL_Log("Controller %i is mapped as \"%s\".", i, mapping); printf("Controller %i is mapped as \"%s\".", i, mapping);
SDL_free(mapping); SDL_free(mapping);
mGameControllerFound = true; mGameControllerFound = true;
} }
else else
{ {
SDL_Log("Index \'%i\' is not a compatible controller.", i); printf("Index \'%i\' is not a compatible controller.", i);
mGameControllerFound = false; mGameControllerFound = false;
} }
} }

View File

@@ -45,7 +45,7 @@ private:
GameControllerBindings_t mGameControllerBindings[15]; // Vector con las teclas asociadas a los inputs predefinidos GameControllerBindings_t mGameControllerBindings[15]; // Vector con las teclas asociadas a los inputs predefinidos
SDL_GameController *mGameController; // Manejador para el mando SDL_GameController *mGameController; // Manejador para el mando
SDL_Haptic *mControllerHaptic; // Manejador para el mando con vibración //SDL_Haptic *mControllerHaptic; // Manejador para el mando con vibración
bool mGameControllerFound; // Variable para saber si hay un mando conectado bool mGameControllerFound; // Variable para saber si hay un mando conectado
int mSource; // Indica si el objeto usará un mando o un teclado int mSource; // Indica si el objeto usará un mando o un teclado