Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Gamepad

Hierarchy

  • Gamepad

Index

Properties

axes

axes: ReadonlyArray<number>

Gamepad axes (for the "standard" mapping, this means only the thumbsticks, not any triggers.)

"standard" mapping values per https://w3c.github.io/gamepad/#remapping :

  • [0] L. Stick X Right
  • [1] L. Stick Y Down
  • [2] R. Stick X Right
  • [3] R. Stick Y Down

See also:

buttons

buttons: ReadonlyArray<GamepadButton>

Gamepad buttons (for the "standard" mapping, this include the triggers.)

"standard" mapping values per https://w3c.github.io/gamepad/#remapping :

  • [ 0] A
  • [ 1] B
  • [ 2] X
  • [ 3] Y
  • [ 4] L. Shoulder
  • [ 5] R. Shoulder
  • [ 6] L. Trigger
  • [ 7] R. Trigger
  • [ 8] Back/View
  • [ 9] Start/Menu
  • [10] L. Thumb
  • [11] R. Thumb
  • [12] Dpad Up
  • [13] Dpad Down
  • [14] Dpad Left
  • [15] Dpad Right
  • [16] Guide (x)

See also:

connected

connected: boolean

Optional displayId

displayId: number

id

id: string

A browser specific string defining what kind of gamepad this is. Note that this does not uniquely identify the gamepad, multiple gamepads of the same type (or even different types, if provided through xinput) may share the same Gamepad.id. If you want to differentiate multiple gamepads, instead use Gamepad.index.

Examples observed:

  • "xinput"
  • "Xbox 360 Controller (XInput STANDARD GAMEPAD)"
  • "DUALSHOCK®4 USB Wireless Adaptor (Vendor: 054c Product: 0ba0)"
  • "054c-0ba0-DUALSHOCK®4 USB Wireless Adaptor"
  • "Wireless Controller (STANDARD GAMEPAD Vendor: 054c Product: 09cc)"
  • "054c-09cc-Wireless Controller"

See also:

index

index: number

A unique index corresponding to this gamepad. Stable for as long as the gamepad is connected. Might be reused if the gamepad is disconnected and a new one connected in it's place. Corresponds to the index of Gamepad[] arrays that have not culled null/undefined/nonstandard gamepads only!

See also:

mapping

mapping: GamepadMappingType

timestamp

timestamp: number

Generated using TypeDoc