Re: [Gamepad] Liveness of Gamepad objects

On Tue, Apr 29, 2014 at 9:38 PM, Rick Waldron <waldron.rick@gmail.com>wrote:

>
>
>
> On Tue, Apr 29, 2014 at 7:28 PM, Glenn Maynard <glenn@zewt.org> wrote:
>
>> Gamepad objects should definitely be a snapshot.  Otherwise, change
>> events could only expose the most recent state of the gamepad.  For
>> example, if the user presses a button and then releases it very quickly
>> (before the down press gets handled by script), and you fire two change
>> events, the script would never see the buttons as pressed.
>>
>
> The previously node-dualshock-controller API, emits "change" events from
> the "live" object. The "change" event delivers the state of the actual
> change. A user might "quickly" press button "A" and the listener for "A"
> does whatever updating it must do in the program and has access to both the
> "change state" and the current "live state" of the object.
>


The node-xbox-controller module also follows this design.

Rick

Received on Wednesday, 30 April 2014 01:42:24 UTC