Re: [Gamepad] Liveness of Gamepad objects

On 4/30/2014 12:21 AM, Glenn Maynard wrote:
>
>     My original prototype provided the events mentioned above. The
>     feedback I received was overwhelmingly in favor of a polling API
>     instead[3]. I decided to go ahead with that (actually Scott beat
>     me to the punch and implemented that in Chrome first), figuring we
>     could always spec events in a future revision.
>
>
> (Please try to direct conversations here or to the whatwg list, so
> everyone has a chance to participate...)
If you note the dates you can see that this was well before
standardization work started. This was just feedback on a prototype.

>
> Supporting polling is a separate issue from whether the Gamepad
> interface is live or a snapshot.  You definitely want to be able to
> retrieve a snapshot of the current state, and as long as you can do
> that you automatically support polling.
>

Yes, it's true. In any event, this is going a bit afield. We're not
going to spec events for the first version of the spec. We have two
mostly-compatible implementations shipping in Firefox and Chrome
supporting polling, I'd just like to nail down the remaining uncertain
bits of the spec (like the topic at hand) so others can ship compatible
implementations. Once that's done we can certainly discuss features for
a next revision, there's already a wiki page[1] to gather ideas.

> (Aside: I'm not sure if the top one is correct.  Does
> getGamepads()[n].index == n, so that gamepadState[i] always
> corresponds to lastGamepadState[i]?  The spec suggests that with
> "index of the gamepad in the Navigator", but I'm not sure.  If so,
> what is getGamepads()[1] if controller index 1 is disconnected, since
> you can't reorder the later items?  undefined?)
Yes, Gamepad.index is the index into the list returned by
navigator.getGamepads(), so that holds true. If the latter portion isn't
answered in the spec I can add some text to clarify: there are allowed
to be holes in the array where controllers were removed. I'm not sure
what they are in current practice, but null or undefined both seem like
legitimate values.

-Ted

1. https://www.w3.org/wiki/Webapps/GamepadFeatures

Received on Wednesday, 30 April 2014 10:59:26 UTC