SDL joystick directions

Can anyone tell me what values SDL_JoystickGetAxis() should be returning
for the Y axis?

I’m using an xbox controller, with the xbcd driver
(http://www.redcl0ud.com/xbcd.html) under windows, and the xpad module
under linux.

On linux, the Y axis (axis 1) returns:
up: 32767
down -32767

On windows, the same code returns:
up: -32767
down: 32767

Which one is returning the correct values? The SDL docs don’t really say
what to expect…

I’d be really surprised if SDL_JoystickGetAxis() displayed different
behaviour under windows to under linux, so my bet is that one of my
drivers is buggy. But which one?

Thanks,
Ben.

Donny Viszneki wrote:

Can anyone tell me what values SDL_JoystickGetAxis() should be
returning for the Y axis?
I’m using an xbox controller, with the xbcd driver
(http://www.redcl0ud.com/xbcd.html) under windows, and the xpad module
under linux.

Did you build your own USB adapter? Or buy one? Just out of curiosity…

It’s from Lik Sang. Much neater and tidier than anything I could
construct myself :slight_smile:

On linux, the Y axis (axis 1) returns:
up: 32767
down -32767

On windows, the same code returns:
up: -32767
down: 32767

Traditionally, negative represents the directions DOWN and LEFT. So
negative values on horizontal axes are left of center, and negative
values on vertical axes are below center. You should take a look at the
source code for xbcd and xpad and compare them. I recommend sending an
email to xbcd about the problem.

Cool - thanks for that info. So it looks like the issue is on the
windows side. Hmmm. Xbcd seems to work OK in other (non-SDL) apps under
windows… I wonder if there’s some weird interaction between the SDL
joystick code and xbcd? Will have to do some more investigation…

Interestingly, the (linux) xpad module seems to get the y axis on the
D-Pad (hat?) backwards - at least using jstest. I haven’t investigated
what sdl reports yet. So a look through the xpad source is in order too…

Thanks,
Ben.> On Jun 6, 2005, at 8:07 AM, Ben Campbell wrote: