Implement GameController through SDL2

This commit is contained in:
Adrian Graber
2022-10-27 20:02:02 +09:00
committed by kichikuou
parent 65aa76a337
commit 034ab8dd03
3 changed files with 31 additions and 0 deletions
+14
View File
@@ -104,6 +104,20 @@ NACT::NACT(int sys_ver, uint32 crc32_a, uint32 crc32_b, const Config& config)
}
#endif
#ifdef USE_JOY_SDL
SDL_Init(SDL_INIT_GAMECONTROLLER);
for (int i = 0; i < SDL_NumJoysticks(); ++i) {
if (SDL_IsGameController(i)) {
sdl_gamecontroller = SDL_GameControllerOpen(i);
if (sdl_gamecontroller) {
break;
} else {
WARNING("Could not open gamecontroller %i: %s\n", i, SDL_GetError());
}
}
}
#endif
terminate = false;
restart_after_terminate = false;
}