From 519153ea33732a3fc3fe5387b28774f2450f491b Mon Sep 17 00:00:00 2001
From: Matt Reynolds
sensing, depth sensing, video analysis, gesture recognition, and so on.
+ A gamepad is a physical or virtual input + device that provides button and/or axis inputs. The + host is the operating system environment + hosting the user agent. The host MUST provide an algorithm for + enumerating connected gamepads. A + gamepad is considered connected when the + host is capable of reading new inputs. A gamepad that is not connected + is disconnected. +
++ The host MUST provide an algorithm for synchronously + reading input data from the + gamepad. If the host does not provide such an algorithm, the user agent + MAY implement an algorithm that caches the most recent input data and + synchronously returns the cached value. +
++ When a gamepad transitions from disconnected to connected, it + becomes connected. Likewise, + when a gamepad transitions from connected to disconnected, it + becomes disconnected. The + host MUST provide algorithms to register listeners for these + transitions. If these events are not available, the user agent MAY + implement an algorithm that synthesizes the events by periodically + enumerating connected gamepads. +
++ The user agent MUST define a + gamepad user gesture. A + gamepad user gesture is a class of gamepad input state transitions that + signify that the user is interacting with the gamepad. At a minimum, the + gamepad user gesture MUST include state changes where any button + transitions from unpressed to pressed. Other transitions MAY be included + as user gestures. A transition MUST NOT be included if the transition + could occur without user interaction. +
++ The user agent MUST NOT expose information about connected gamepads + until a gamepad user gesture has been received from any connected + gamepad. The user gesture MUST be tracked independently for each gamepad + context. A gamepad context MUST be + created when a page first requests the current gamepad state or + registers for gamepad connection events. The gamepad context MUST be + destroyed when the tab is closed or navigates away from the current + page. Reloading the current page MUST NOT destroy the gamepad context. +
++ To register a user gesture, a gamepad context MUST be active. A gamepad + context is active if the page associated with the context is visible and + the page is capable of executing script. If the page is not visible or + the page cannot execute script, the context is inactive. When a context + is first created or when it transitions from inactive to active, it + becomes active. Likewise, when + it transitions from active to inactive, it + becomes inactive. +
++ The steps to register a new gamepad context. +
++ The steps to transition a gamepad context to an active state. +
+