Fatal Signals w/ joystick

Hey,

I just added code to initialize joysticks in my RPG, but now the program exits with a signal error. I added code to tell me basic info about the joystick (name, #axes, #buttons, etc). The name displays correctly, but everything else returns ‘-1’. What could I be doing wrong?

thanks,
Cameron Matheson

“Cameron Matheson” wrote

I just added code to initialize joysticks in my RPG, but now the
program exits with a signal error. I added code to tell me basic
info about the joystick (name, #axes, #buttons, etc). The name
displays correctly, but everything else returns ‘-1’. What could
I be doing wrong?

cameron, most of the joystick functions require that the
joystick be opened before using functions on them. the "name"
function is one of the few (hmm, perhaps the only) joystick
call that does not need the joystick object properly opened.

read about SDL_JoystickOpen
http://sdldoc.sourceforge.net/current/sdljoystickopen.html

hmm, doh! been getting a little too used to my own SDL wrapper.
it looks like you can’t even get the joystick pointer without
calling the open function. sorry that might not help much.
try calling SDL_GetError after getting a -1. i’ve found the
SDL errors to be very descriptive and helpful.