Bogus values reading joystick

I’ve recently bought a gamepad to add joystick support to our games. It’s my
first gamepad (I’m not a console guy) so I can only describe it as having
two sticks and a lot of buttons :slight_smile:

I’m having some trouble reading the axis values - on startup, all axes
return -32767, until I barely touch the stick. At that point, the axis I
affected returns to 0 and works correctly afterwards.

Has anyone else experienced this? Sounds like some kind of uninitialized
variable in SDL? This is in Linux, if it matters.

Thanks,
–Gabriel

On some platforms I’ve experienced weirder problems, like the joystick
not really fully working until I gave it a full exercise (360 degrees
at maximum magnitude.) I always assumed this was some auto-calibration
feature and I was never really sure where this was occurring, but it
seemed preferable to having to manually calibrate anything.On Mon, Jun 15, 2009 at 9:51 AM, Gabriel Gambetta wrote:

I’ve recently bought a gamepad to add joystick support to our games. It’s my
first gamepad (I’m not a console guy) so I can only describe it as having
two sticks and a lot of buttons :slight_smile:

I’m having some trouble reading the axis values - on startup, all axes
return -32767, until I barely touch the stick. At that point, the axis I
affected returns to 0 and works correctly afterwards.

Has anyone else experienced this? Sounds like some kind of uninitialized
variable in SDL? This is in Linux, if it matters.

Thanks,
–Gabriel


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


http://codebad.com/