Skip to main content

Interface: GamepadLike

Defined in: src/interaction/GamepadInput.ts:64

The subset of a Gamepad the controller reads. A real Gamepad satisfies this shape, so navigator.getGamepads() feeds the controller directly, and a test injects a plain object with the same fields.

Properties​

axes​

readonly axes: readonly number[]

Defined in: src/interaction/GamepadInput.ts:76

The axis values in [-1, 1], indexed by the standard-mapping order.


buttons​

readonly buttons: readonly GamepadButtonLike[]

Defined in: src/interaction/GamepadInput.ts:74

The button states, indexed by the standard-mapping order.


connected?​

readonly optional connected: boolean

Defined in: src/interaction/GamepadInput.ts:70

Whether the pad is connected. Absent is treated as connected.


id?​

readonly optional id: string

Defined in: src/interaction/GamepadInput.ts:68

The device id, when the pad exposes one.


index​

readonly index: number

Defined in: src/interaction/GamepadInput.ts:66

The pad's index in the snapshot array.


mapping?​

readonly optional mapping: string

Defined in: src/interaction/GamepadInput.ts:72

The W3C mapping name, typically 'standard'.