![]() |
|
Allegro Joystick Axes messed up.. help |
cdxrd
Member #7,061
March 2006
|
Ok, Im running into issues here.. Not too big, but enough to warrant concern on my part as I want to make this work properly. When I compile and run the following code, it autodetects the joysticks, displays the button info properly including a color change for button presses, but when it displays the axis information, its wrong. The gamepad Im using is a Saitek 2900 wireless.. Works perfect.. Has 1 8way hat, 2 sticks and 14 buttons.. The 2 sticks each have an x & y axis along with a button.. When I run this, allegro tells me I have 3 sticks.. Heres what it displays: Stick 0: stick Axis 0: x axis - 0 Stick 1: z-rotation Axis 0: -128 <<<<<<<<<< this is the right hand stick, its x axis.. -128 centered, 0 is to the left, 256 to the right Stick 2: hat Switch Everything works great except for the right stick has its Y axis listed under stick 0 with a different range of values than its x axis.. I know I could set it to use the left stick, but I wanted to use the right as well. Problem is, if it were just for me, I could code it right.. But if I want to release it, Im sure its going to read the sticks different.. So why does stick 1 have its Axes listed as 2 different sticks in allegro????? For what its worth, its something in allegro doing this. Ive tested this using directinput and XNA and it reads the stick and axes properly, so does the windows control panel. Allegro is the only place it shows the right stick as a z rotation.
|
Jakub Wasilewski
Member #3,653
June 2003
![]() |
I remember there was a thread about Allegro messing up the stick<->axis relation a while ago. I believe it was found to be a bug in the library, but I can't remember if anyone got to fix it. --------------------------- |
Kris Asick
Member #1,424
July 2001
|
When you're working with joysticks it's best not to assume anything and to always allow the user to configure their joystick to your game. There have been a number of games out there which I haven't been able to play with my joystick simply because it lacked decent joystick configuration routines. The default joystick structure in DirectX doesn't separate sticks and axises like Allegro does. It basically has room for six standard axises, four hats, two slider axises, and 32 buttons, for each joystick. To detect more than that is seriously complicated and I doubt any of the Allegro devs would've done so. But what Allegro does is unify all this data into sticks and axises per stick. I believe Allegro separates them as follows (though I haven't looked to confirm this): Stick 0: 3 Standard Axises, First Slider My MS Precision Pro joystick (1 twistable stick, 1 throttle, 1 hat, 9 buttons) comes up as: Stick 0: X, Y and Throttle --- Kris Asick (Gemini) --- Kris Asick (Gemini) |
cdxrd
Member #7,061
March 2006
|
Ok, its just driving me nuts that one axis of stick 1 shows as stick 0's 3rd axis, while the other axis actually shows as stick 1.. guess I wont use the right stick.. just the left, hat and buttons maybe.. I would like to have it configurable so that if I have a config screen, I can tell the player to press their UP ont he gamepad and find a way to map that.. but Im not really quite sure how to go about that.. |
Richard Phipps
Member #1,632
November 2001
![]() |
This is an old problem. I pointed it out a few times, but I don't think there are any active windows developers to fix it anymore. |
Matt Smith
Member #783
November 2000
|
If it's any consolation, the results you get are consistent for any dual-shock style gamepad running on Windows. You can hard-code the axes you have and it will work for many people. On the other hand, a configuration screen will be universally useful, both for when people use a non-dual shock, aren't on Windows, or somebody fixes this bug. I keep meaning to code the GUI to do this but I haven't got around to it yet, sorry |
Matthew Leverton
Supreme Loser
January 1999
![]() |
Does either JOY_TYPE_DIRECTX or JOY_TYPE_WIN32 work better? |
cdxrd
Member #7,061
March 2006
|
I will have to try both, I put it down for a while.. time to pick it up again.. Ill check on this and edit this post here shortly.. Same results either way I go. I know Ive played with SDL's joystick routines before and it detected alright.. I may have to hardcode it in somehow, its just gonna be odd.. =( Problem Im gonna have is my stick 2 X axis reads from 0 - 256, while the Y axis reads -128 to 128.. grrrrr.... I suppose stick 2 really isnt going to be that important tho... |
|