[AD] Problems with gamepad on MacOS X and general thoughts

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


First, MacOS X gamepad code assumes that number of sticks on device is equivalent to number of X axes. This is not always true: for my gamepad, there are 1 reported X axis, 1 Y axis and 2 Z axis. Currently, the extra Z axis gets lost for Allegro :) I think this piece of code needs to be rewritten not to assume number of sticks in this way.

MaxOS X gamepad code also can't handle d-pad on my gamepad. It has usage == kHIDUsage_GD_Hatswitch and needs special handling, because its element represents both axes at once (or maybe it should be mapped to four buttons?).

I think I can fix those two problems myself, but first I'd like to talk about a more general thing: I see that Allegro's idea of separate "sticks" fails on so many platforms it seems to be useless. Time and time again I get sticks with 3 axes for my gamepad. Mostly, X-axis of my right sticks gets reported as Z-axis of the left stick. I think this is a problem with drivers, but it's a problem Allegro can't correct, and it leads to confusion. I know that would be a backward compatibility breaking change, but maybe we should consider abandoning the idea of sticks, and return to a set of independent axes instead, as with SDL? The current setup gives end-user false sense of security, he might think that 0th axis of a stick always will be horizontal, and 1st axis will be vertical, and there can be no 2nd axis on a standard gamepad. But this is not true :)

As an alternative, we may retain the current setup, but finally give users controller database, so they might treat sticks and axes reported by joystick events as "magic", opaque values, from which the REAL controls might be obtained by querying controller DB (i.e., for my gamepad, stick 0 axis 3 will map to stick 1 axis 0). This keeps backward compatibility, but will multiply user confusion. Moving away from sticks would allow to simplify joystick drivers for all platforms somewhat, and give us a bit more compatibility with SDL.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/