Skip to content

Commit cb415db

Browse files
committed
Update docs on gamepad index mapping
1 parent 52a3dbe commit cb415db

File tree

1 file changed

+11
-1
lines changed
  • src/common/protocol/input

1 file changed

+11
-1
lines changed

src/common/protocol/input/new.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,18 @@ interface BaseGamepadEvent<Control extends string> extends BaseInputEvent<'gamep
5252
/**
5353
* The (control-specific) index of the control.
5454
*
55-
* This corresponds to the standard layout specified in
55+
* Buttons correspond to the standard layout specified in
5656
* https://www.w3.org/TR/gamepad/#dfn-standard-gamepad.
57+
*
58+
* Axes are mapped slightly differently:
59+
*
60+
* | Web API Standard Gamepad | This API |
61+
* | --------------------------- | -------------- |
62+
* | Axis 0 (left stick x-axis) | Axis2D 0 |
63+
* | Axis 1 (left stick y-axis) | Axis2D 0 |
64+
* | Axis 2 (right stick x-axis) | Axis2D 1 |
65+
* | Axis 3 (right stick y-axis) | Axis2D 1 |
66+
* | Axis n (for n >= 4) | Axis (n - 4) |
5767
*/
5868
index: number;
5969
}

0 commit comments

Comments
 (0)