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

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


On 03/22/2015 01:01 AM, Max Savenkov wrote:
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 I've said before, I think it's perfectly reasonable to add a new way of filling out the joystick information that's configurable via allegro5.cfg (i.e. you can get the current 'legacy' mode like that), this has precedent. In terms of API, I imagine this could mean that every stick would now have only a single axis, and we could add a `al_get_joystick_raw_axis{_name,_flags}(joy, axis)` function and slowly deprecate the other APIs.

I kind of like A5's way of doing this over SDLs, but if it cannot be made to work, I think we should abandon it.

-SL





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