[SDL] Multiple joystick detection
knowyotoe at yahoo.com
Fri May 14 22:20:06 PDT 2004
I have 2 joysticks attached to my computer which both definitely work with other
programs simultaneously. When calling SDL_NumJoysticks(), however, only one is
reported as existing. The following code is what I used.
// SDL init
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
// joystick detection
printf("Number of joysticks: %i\n", SDL_NumJoysticks());
for (int i = 0; i < SDL_NumJoysticks(); i++)
printf(" name: %s, axes: %d, buttons: %d, hats: %d, balls: %d\n",
Support for multiple joysticks is crucial to the game I am working on. Any help
with this problem would be greatly appreciated.
More information about the SDL