# GamepadState

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

Gamepad state snapshot.

```ds title="GamepadState"
export struct GamepadState {
    timestampNs: uint64;
    isConnected: boolean;
    deviceId: string;
    instanceId: string;
    guid: string;
    hostName: string;
    mappingName: string;
    mapping: GamepadMapping;
    connection: GamepadConnection;
    playerIndex: uint8;
    slotIndex: uint8;
    battery: GamepadBattery;
    supportsRumble: boolean;
    supportsTriggerRumble: boolean;
    supportsMotion: boolean;
    supportsTouch: boolean;
    supportsLight: boolean;
    isMotionEnabled: boolean;
    motionSampleRateHz: float64;
    axes: float64[];
    buttons: GamepadButton[];
    touches: GamepadTouch[];
    motion: GamepadMotion;
}
```

[language/library/src/input/binding/gamepad.ds:116:163](https://github.com/destack-sh/destack/blob/main/language/library/src/input/binding/gamepad.ds#L116-L163)

## 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.
