On Sun, Mar 15, 2015 at 11:18 PM, Max Savenkov <
max.savenkov@xxxxxxxxxxxx> wrote:
>
>
> 16.03.2015 0:43 пользователь "Elias Pschernig" <
elias@xxxxxxxxxx> написал:
> >
> > On Sun, Mar 15, 2015 at 10:38 PM, Max Savenkov <
max.savenkov@xxxxxxxxxx> wrote:
> >>
> >> > Shouldn't we make a trigger a *button* instead of an *axis* maybe?
> >>
> >> When trigger is digital, it's a button already, I believe. But when it's analogue, we'd better keep it as an axis.
> >
> >
> > Why? To me the different range (0..1 instead of -1..1) would be a very strong reason not to keep it as an axis. It also isn't an "axis", it's a trigger *button*.
>
> Well, to me, the main problem is, my code is not ready to handle buttons that have analogue position :) ALLEGRO_JOYSTICK_BUTTON_UP/DOWN only have button index, and that's all right by me. And forcefully making analogue triggers into binary buttons at Allegro level would be plain wrong, if you mean that (but I'm sure you don't). Someone might like to measure how far the trigger was pressed, after all!
>
> So, with the choice being to
> a) Add position to button events
Oh, I didn't know button events don't report the position, only state. This means they are only binary for now, true. And to report pressure, we'd also have to create continuous ALLEGRO_JOYSTICK_BUTTON_DOWN events for the same button and differing value.
>
> b) Keep triggers as axes
>
> I'd choose b)
Well, it's quite obvious that nobody used the joystick API much, with a few rather glaring oversights like the half implemented button pressure.
So yes, I'm fine with triggers as axes then I guess. As for the range, there is an:
al_get_joystick_stick_flags()
function already. It is for a stick not an axis, but if we do it as you suggested and a trigger would be a stick with only one axis, that is fine. We could have an ALLEGRO_JOYFLAG_TRIGGER flag for such a stick and it would then indicate that all axes (normally only one) are trigger axes and report in the range 0..1 only.