menu
GamepadState
import { GamepadState } from "destack:input/binding";
Gamepad state snapshot.
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: uint64Monotonic update timestamp in nanoseconds.
isConnected: booleanWhether the gamepad is currently connected.
deviceId: stringStable source device identifier.
instanceId: stringStable instance identifier when available.
guid: stringStable gamepad GUID when available.
hostName: stringHost device name when available.
mappingName: stringActive mapping display name when available.
mapping: GamepadMappingActive gamepad mapping.
connection: GamepadConnectionConnection kind when available.
playerIndex: uint8Player index in the range
[0, 15]when available.slotIndex: uint8Stable web-style slot index when assigned.
battery: GamepadBatteryBattery status.
supportsRumble: booleanWhether this device supports whole-device rumble.
supportsTriggerRumble: booleanWhether this device supports trigger rumble.
supportsMotion: booleanWhether this device exposes motion sensors.
supportsTouch: booleanWhether this device exposes touch surfaces.
supportsLight: booleanWhether this device supports light control.
isMotionEnabled: booleanWhether motion sensors are currently enabled.
motionSampleRateHz: float64Effective 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: GamepadMotionMotion state when sensors are enabled.