From 22010dc55f2aab103e4faeb6529abceb998b53f2 Mon Sep 17 00:00:00 2001
From: Sun Shin
@@ -952,6 +953,17 @@
readonly attribute boolean pressed;
readonly attribute boolean touched;
readonly attribute double value;
+ readonly attribute GamepadButtonType type;
};
.. 1.0]
+
+
+ [[\type]]
+
+
+ `undefined`
+
+
+ Indicates the button type the controller is held in.
+
+
+
canonical ordering when possible. Devices that are not recognized
should still be exposed in their raw form.
- There is currently one canonical layout, the Standard - Gamepad. When remapping, the indices in {{Gamepad/axes}} and - {{Gamepad/buttons}} should correspond as closely as possible to the - physical locations in the diagram below. Additionally, - {{Gamepad/mapping}} SHOULD be set to {{GamepadMappingType/"standard"}}. -
-- The [=Standard Gamepad=] buttons are laid out in a left cluster of four - buttons, a right cluster of four buttons, a center cluster of three - buttons, and a pair of front facing buttons on the left and right side - of the gamepad. The four axes of the "Standard Gamepad" are associated - with a pair of analog sticks, one on the left and one on the right. The - following table describes the buttons/axes and their physical - locations. -
-- An axis input represents a Standard Gamepad axis if it - reports the input value for a thumbstick axis, the thumbstick is - located in approximately the same location as the corresponding - [=Standard Gamepad=] thumbstick, and the orientation of the axis - (up-down or left-right) matches the orientation of the [=Standard - Gamepad=] axis. If there are multiple axes that represent the same - [=Standard Gamepad=] axis, then the [=user agent=] SHOULD select one to - be the [=Standard Gamepad=] axis and assign a different index to the - other axis. -
-- A button input represents a Standard Gamepad button if it - reports the input value for a button or trigger, and the button or - trigger is located in approximately the same location as the - corresponding [=Standard Gamepad=] button. -
-- If an axis or button input represents a [=Standard Gamepad=] axis or - button, then its canonical index is the index of the - corresponding [=Standard Gamepad=] axis or button. -
-- Button/Axis - | -- Location - | -
---|---|
- buttons[0] - | -- Bottom button in right cluster - | -
- buttons[1] - | -- Right button in right cluster - | -
- buttons[2] - | -- Left button in right cluster - | -
- buttons[3] - | -- Top button in right cluster - | -
- buttons[4] - | -- Top left front button - | -
- buttons[5] - | -- Top right front button - | -
- buttons[6] - | -- Bottom left front button - | -
- buttons[7] - | -- Bottom right front button - | -
- buttons[8] - | -- Left button in center cluster - | -
- buttons[9] - | -- Right button in center cluster - | -
- buttons[10] - | -- Left stick pressed button - | -
- buttons[11] - | -- Right stick pressed button - | -
- buttons[12] - | -- Top button in left cluster - | -
- buttons[13] - | -- Bottom button in left cluster - | -
- buttons[14] - | -- Left button in left cluster - | -
- buttons[15] - | -- Right button in left cluster - | -
- buttons[16] - | -- Center button in center cluster - | -
- axes[0] - | -- Horizontal axis for left stick (negative left/positive right) - | -
- axes[1] - | -- Vertical axis for left stick (negative up/positive down) - | -
- axes[2] - | -- Horizontal axis for right stick (negative left/positive right) - | -
- axes[3] - | -- Vertical axis for right stick (negative up/positive down) - | -
+
+ There is currently one canonical layout, the Standard + Gamepad. When remapping, the indices in {{Gamepad/axes}} and + {{Gamepad/buttons}} should correspond as closely as possible to the + physical locations in the diagram below. Additionally, + {{Gamepad/mapping}} SHOULD be set to {{GamepadMappingType/"standard"}}. +
++ The [=Standard Gamepad=] buttons are laid out in a left cluster of four + buttons, a right cluster of four buttons, a center cluster of three + buttons, and a pair of front facing buttons on the left and right side + of the gamepad. The four axes of the "Standard Gamepad" are associated + with a pair of analog sticks, one on the left and one on the right. The + following table describes the buttons/axes and their physical + locations. +
++ An axis input represents a Standard Gamepad axis if it + reports the input value for a thumbstick axis, the thumbstick is + located in approximately the same location as the corresponding + [=Standard Gamepad=] thumbstick, and the orientation of the axis + (up-down or left-right) matches the orientation of the [=Standard + Gamepad=] axis. If there are multiple axes that represent the same + [=Standard Gamepad=] axis, then the [=user agent=] SHOULD select one to + be the [=Standard Gamepad=] axis and assign a different index to the + other axis. +
++ A button input represents a Standard Gamepad button if it + reports the input value for a button or trigger, and the button or + trigger is located in approximately the same location as the + corresponding [=Standard Gamepad=] button. +
++ If an axis or button input represents a [=Standard Gamepad=] axis or + button, then its canonical index is the index of the + corresponding [=Standard Gamepad=] axis or button. +
++ Button/Axis + | ++ Location + | +
---|---|
+ buttons[0] + | ++ Bottom button in right cluster + | +
+ buttons[1] + | ++ Right button in right cluster + | +
+ buttons[2] + | ++ Left button in right cluster + | +
+ buttons[3] + | ++ Top button in right cluster + | +
+ buttons[4] + | ++ Top left front button + | +
+ buttons[5] + | ++ Top right front button + | +
+ buttons[6] + | ++ Bottom left front button + | +
+ buttons[7] + | ++ Bottom right front button + | +
+ buttons[8] + | ++ Left button in center cluster + | +
+ buttons[9] + | ++ Right button in center cluster + | +
+ buttons[10] + | ++ Left stick pressed button + | +
+ buttons[11] + | ++ Right stick pressed button + | +
+ buttons[12] + | ++ Top button in left cluster + | +
+ buttons[13] + | ++ Bottom button in left cluster + | +
+ buttons[14] + | ++ Left button in left cluster + | +
+ buttons[15] + | ++ Right button in left cluster + | +
+ buttons[16] + | ++ Center button in center cluster + | +
+ axes[0] + | ++ Horizontal axis for left stick (negative left/positive right) + | +
+ axes[1] + | ++ Vertical axis for left stick (negative up/positive down) + | +
+ axes[2] + | ++ Horizontal axis for right stick (negative left/positive right) + | +
+ axes[3] + | ++ Vertical axis for right stick (negative up/positive down) + | +
+ This section introduces an extended gamepad button mapping beyond the Standard Gamepad layout. + These additional buttons are commonly found on certain gamepad models. + The following table defines the extended buttons used by some gamepad models in the following diagrams. + It’s important to note that this list is not exhaustive, and user agents may utilize different + or additional buttons for these or other gamepad models. + Consequently, the number of buttons on the Gamepad is not limited to the standard mapping of 17 buttons. +
++ To accommodate extended gamepads, we have incorporated an "extended" mapping enumeration + into the GamepadMappingType. Additionally, we have defined an enumeration for the various + button types in the table, termed "GamepadButtonType", and have expanded the "GamepadButton" + interface to encompass this new button type enumeration. +
+Buttons | +Gamepad Models | +
---|---|
trackpad/touchpad | +Sony DualSense, DualShock 4 | +
share/capture | +Xbox Wireless Controller Model 1914 + Nintendo Switch controllers + Stadia controller + |
+
voice assistant | +Google Stadia Controller + Amazon Luna Controller + |
+
home | +Nvidia Shield Gamepad | +
squeeze_left | +Xbox Elite Wireless Controller + PlayStation DualSense Edge |
+
squeeze_left_lower | +Xbox Elite Wireless Controller | +
squeeze_right | +Xbox Elite Wireless Controller + PlayStation DualSense Edge |
+
squeeze_right_lower | +Xbox Elite Wireless Controller | +
+ This enum defines the set of possible button types. +
++ enum GamepadButtonType { + "", /* unknown, or not applicable */ + "trackpad", + "share" + }; ++