Multiple joystick detection

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());
    exit(1);
}

// joystick detection
SDL_JoystickEventState(SDL_ENABLE);

printf("Number of joysticks: %i\n", SDL_NumJoysticks());
printf("Opening joysticks:\n");
for (int i = 0; i < SDL_NumJoysticks(); i++) 
{
	joysticks.push_back(SDL_JoystickOpen(i));
    printf("  name: %s, axes: %d, buttons: %d, hats: %d, balls: %d\n", 
		SDL_JoystickName(i),
		SDL_JoystickNumAxes(joysticks[i]),
		SDL_JoystickNumButtons(joysticks[i]),
		SDL_JoystickNumHats(joysticks[i]),
		SDL_JoystickNumBalls(joysticks[i]));
}

Support for multiple joysticks is crucial to the game I am working on. Any help
with this problem would be greatly appreciated.

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.

[…]

Support for multiple joysticks is crucial to the game I am working on.
Any help
with this problem would be greatly appreciated.

Multiple joysticks are supported by SDL in general (as you can tell by
looking at the API). However on some target systems this may not (yet)
be supported… so tell us, on which OS are you experiencing this, and
with which SDL version?

Bye,

MaxAm 15.05.2004 um 07:20 schrieb Josiah: