[AD] Triggers under Linux

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


I have a question about the some code in ljoynu.c. Why doesn't Allegro consider Triggers to be single-axis? Gamepad documentation at https://www.kernel.org/doc/Documentation/input/gamepad.txt tells us that:

"Triggers: Trigger buttons can be available as digital or analog buttons or both. User- space must correctly deal with any situation and choose the most appropriate mode. Upper trigger buttons are reported as BTN_TR or ABS_HAT1X (right) and BTN_TL or ABS_HAT1Y (left). Lower trigger buttons are reported as BTN_TR2 or ABS_HAT2X (right/ZR) and BTN_TL2 or ABS_HAT2Y (left/ZL). If only one trigger-button combination is present (upper+lower), they are reported as "right" triggers (BTN_TR/ABS_HAT1X). (ABS trigger values start at 0, pressure is reported as positive values)"

Allegro's treatment of Triggers leads to some very unpleasant effects, like sticks' ordering being all messed up. Also, Trigger button should have a range of 0.0f..1.0f (as per docs: "ABS trigger values start at 0, pressure is reported as positive values"), but currently provide values from -1.0f to 1.0f.

Therefore, I propose to add a special case to fill_joystick_axes which would handle analogue AND digital triggers (BTN_TR,BTN_TR2, BTN_TL, BTN_TL2, ABS_HAT1X, ABS_HAT2X, ABS_HAT1Y, ABS_HAT2Y), and write them down as a single-axis sticks.




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