Question about SDL_NumJoysticks()

Started by
2 comments, last by dpasquinelli 16 years, 5 months ago
i've got a program that checks for the number of joysticks plugged every half a second. problem is it always reports the number of joysticks that were attached at program startup. i'm trying to find out if this is a windows specific problem, like SDL_ToggleFullscreen only working under unix-alikes, or if i must be doing something stupid. it'd also be cool if anyone happened to know a workaround for this that didn't require me to deal with the native windowing system. it's kind of annoying because it doesn't fail, it's just wrong, so if it's supported in the future, as it stands, i either won't be checking if the user ripped out their controller in the middle of a game, or i'll do it through some stupid one of these:

#ifdef WIN32
   annoying...
#elif
   some more annoying...
#etc...
thanks in advance
Advertisement
This is maybe more of a question for the SDL mailing list.

I would think you're encountering a problem of the operating system. Granted, USB is designed for plug-and-play, but the PC joystick protocol was designed in the days of RS232 Serial Ports, when things had to generally be plugged in before powering on the machine. Removing the mouse or keyboard during play would be just as indeterminate.

I would suggest not worrying about it. If your game has a need for multiple joysticks during play, specify in the README or Instruction Manual that they should all be plugged in before starting the game.
william bubel
SDL 1.2 only detects joysticks on start up you can't see joysticks plugged in after start up. SDL 1.3 is suppose to address this issue.
Black CloakEpee Engine.
cool, thanks to both of you.

This topic is closed to new replies.

Advertisement