Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Gamepad

Represents a gamepad

Hierarchy

Index

Constructors

constructor

  • new Gamepad(id: string, index: number, browserGamepad: any, leftStickX?: number, leftStickY?: number, rightStickX?: number, rightStickY?: number): Gamepad
  • Initializes the gamepad

    Parameters

    • id: string

      The id of the gamepad

    • index: number

      The index of the gamepad

    • browserGamepad: any

      The browser gamepad

    • Optional leftStickX: number

      The x component of the left joystick

    • Optional leftStickY: number

      The y component of the left joystick

    • Optional rightStickX: number

      The x component of the right joystick

    • Optional rightStickY: number

      The y component of the right joystick

    Returns Gamepad

Properties

browserGamepadSearch playground for browserGamepad

browserGamepad: any

The browser gamepad

idSearch playground for id

id: string

The id of the gamepad

indexSearch playground for index

index: number

The index of the gamepad

typeSearch playground for type

type: number

Specifies what type of gamepad this represents

Static DUALSHOCKSearch playground for DUALSHOCK

DUALSHOCK: number

Represents an Dual Shock controller

Static GAMEPADSearch playground for GAMEPAD

GAMEPAD: number

Represents a gamepad controller

Static GENERICSearch playground for GENERIC

GENERIC: number

Represents a generic controller

Static POSE_ENABLEDSearch playground for POSE_ENABLED

POSE_ENABLED: number

Represents a pose-enabled controller

Static XBOXSearch playground for XBOX

XBOX: number

Represents an XBox controller

Accessors

isConnected

  • get isConnected(): boolean
  • Specifies if the gamepad has been connected

    Returns boolean

leftStick

  • Gets the left joystick

    Returns StickValues

  • Sets the left joystick values

    Parameters

    Returns any

rightStick

  • Gets the right joystick

    Returns StickValues

  • Sets the right joystick value

    Parameters

    Returns any

Methods

disposeSearch playground for dispose

  • dispose(): void
  • Disposes the gamepad

    Returns void

onleftstickchangedSearch playground for onleftstickchanged

  • onleftstickchanged(callback: (values: StickValues) => void): void
  • Callback triggered when the left joystick has changed

    Parameters

    Returns void

onrightstickchangedSearch playground for onrightstickchanged

  • onrightstickchanged(callback: (values: StickValues) => void): void
  • Callback triggered when the right joystick has changed

    Parameters

    Returns void

updateSearch playground for update

  • update(): void
  • Updates the gamepad joystick positions

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method