Sign in to follow this  
Dko

SDL Joysticks.

Recommended Posts

Im wondering would having a usb controller in windows effect weather SDL finds it? Because my program im coding keeps returning 0 when I poll SDL_NumJoysticks() and I know my controller is pluged in and working. Thanks in advance for any help.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
It sounds like a bug in the API.

Try reporting it to the SDL newsgroup:
http://news.gmane.org/gmane.comp.lib.sdl

Share this post


Link to post
Share on other sites
I doubt it is a bug in SDL. SDL should not care what type of interface your joystick uses (USB, serial, game port, or otherwise). Did you send the flag SDL_INIT_JOYSTICK to SDL_Init()? You said you know the joystick is working. How have you verified that the joystick is working?

Share this post


Link to post
Share on other sites
Well to put it simply to both your questions yes I have. Ive used my controller on tons of other applications and my call to initialze SDL is this.

// Intialize SDL
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) < 0 )

I have no other clue as to why it won't find my controller.

Share this post


Link to post
Share on other sites
I don't remember, but I seem to recall that SDL_NumJoysticks only returns non-zero after you call SDL_JoystickOpen(joyID). Do you call SDL_JoystickOpen?

Share this post


Link to post
Share on other sites
Yea I do. *sigh* tried to swap two function calls that called them yet it still comes up 0.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this