Enumerations
Button
Mapping of the button indicies on a Gamepad to the
corresponding name of the button on the controller.
Example
import { Button } from '@nx.js/constants';
const pad = navigator.getGamepads()[0];
if (pad.buttons[Button.A].pressed) {
console.log('Button A is pressed');
}Enumeration Members
| Enumeration Member | Value |
|---|---|
A | 1 |
B | 0 |
Down | 13 |
L | 4 |
Left | 14 |
Minus | 8 |
Plus | 9 |
R | 5 |
Right | 15 |
StickL | 10 |
StickR | 11 |
Up | 12 |
X | 3 |
Y | 2 |
ZL | 6 |
ZR | 7 |