[SDL] SDL joystick directions
ben at scumways.com
Wed Jun 8 01:22:24 PDT 2005
Donny Viszneki wrote:
> On Jun 6, 2005, at 8:07 AM, Ben Campbell 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 :-)
>> 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...
More information about the SDL