Re: [gamepad] Add an event-based input mechanism

Note that events for axis input can (when wrongly handled) lead to
undesirable behavior. For instance, suppose you have a 2-axis input you use
to plot a line on screen. If you poll the positions and then draw a line
from the last position to the current position, you will get a smooth line.
However if you receive events for axes, each arriving separately, and use
each to plot a line, you will get a stepped/stairs line.

If nothing but an event based mechanism is present, this would force an
author to catch all axes events and collate them when no more events are
queued. That'd require knowing "when are no more events coming", which
cannot be done in a callback based mechanism (as the event queue can't be
queried).

It's conceivable that some use-cases of buttons can run into similar
scenarios (combos and whatnot). Although in these cases, a developer could
probably keep track of the pressed buttons themselves. However, this means
that not only button presses have to be provided, but also button releases,
such that combos could be reliably detected by the developer.

On Mon, Oct 13, 2014 at 9:03 AM, Chad Austin <caustin@gmail.com> wrote:

> Just as I mentioned in my previous email to this list, I recently was
> asked to review the Gamepad API draft specification.  My background is
> games though I've done some scientific computing with alternate input
> devices too.
>
> http://chadaustin.me/2014/10/the-gamepad-api/
>
> I'd like to make a second proposed change to the gamepad API, an
> event-based mechanism for receiving button and axis changes.
>
> The full rationale is explained in the linked article, but the summary is:
>
> 1) an event-based API entirely avoids the issue of missed button presses
> 2) event-based APIs don't require non-animating web pages to use
> requestAnimationFrame just to poll gamepad state
> 3) an event-based API could (and should!) give access to high-precision
> event timing information for use in gesture recognition and scientific
> computing
> 4) event-based APIs can reduce processing latency when a button changes
> state rapidly in low-frame-rate situations
>
> --
> Chad Austin
> http://chadaustin.me
>

Received on Monday, 13 October 2014 08:06:42 UTC