menu

GamepadState

import { GamepadState } from "destack:input/binding";

Gamepad state snapshot.

language/library/src/input/binding/gamepad.ds:116:163
1export struct GamepadState {2    timestampNs: uint64;3    isConnected: boolean;4    deviceId: string;5    instanceId: string;6    guid: string;7    hostName: string;8    mappingName: string;9    mapping: GamepadMapping;10    connection: GamepadConnection;11    playerIndex: uint8;12    slotIndex: uint8;13    battery: GamepadBattery;14    supportsRumble: boolean;15    supportsTriggerRumble: boolean;16    supportsMotion: boolean;17    supportsTouch: boolean;18    supportsLight: boolean;19    isMotionEnabled: boolean;20    motionSampleRateHz: float64;21    axes: float64[];22    buttons: GamepadButton[];23    touches: GamepadTouch[];24    motion: GamepadMotion;25}

Members

timestampNs: uint64

Monotonic update timestamp in nanoseconds.

isConnected: boolean

Whether the gamepad is currently connected.

deviceId: string

Stable source device identifier.

instanceId: string

Stable instance identifier when available.

guid: string

Stable gamepad GUID when available.

hostName: string

Host device name when available.

mappingName: string

Active mapping display name when available.

mapping: GamepadMapping

Active gamepad mapping.

connection: GamepadConnection

Connection kind when available.

playerIndex: uint8

Player index in the range [0, 15] when available.

slotIndex: uint8

Stable web-style slot index when assigned.

battery: GamepadBattery

Battery status.

supportsRumble: boolean

Whether this device supports whole-device rumble.

supportsTriggerRumble: boolean

Whether this device supports trigger rumble.

supportsMotion: boolean

Whether this device exposes motion sensors.

supportsTouch: boolean

Whether this device exposes touch surfaces.

supportsLight: boolean

Whether this device supports light control.

isMotionEnabled: boolean

Whether motion sensors are currently enabled.

motionSampleRateHz: float64

Effective motion sample rate in hertz when available.

axes: float64[]

Axis values in normalized host order.

buttons: GamepadButton[]

Button values in normalized host order.

touches: GamepadTouch[]

Touch contacts when the device exposes touch surfaces.

motion: GamepadMotion

Motion state when sensors are enabled.