Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents a gamepad

Hierarchy

Index

Constructors

  • 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

browserGamepad: any

The browser gamepad

id: string

The id of the gamepad

index: number

The index of the gamepad

type: number

Specifies what type of gamepad this represents

DUALSHOCK: number

Represents an Dual Shock controller

GAMEPAD: number

Represents a gamepad controller

GENERIC: number

Represents a generic controller

POSE_ENABLED: number

Represents a pose-enabled controller

XBOX: number

Represents an XBox controller

Accessors

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

    Returns boolean

  • Gets the left joystick

    Returns StickValues

  • Sets the left joystick values

    Parameters

    Returns void

  • Gets the right joystick

    Returns StickValues

  • Sets the right joystick value

    Parameters

    Returns void

Methods

  • dispose(): void
  • Disposes the gamepad

    Returns void

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

    Parameters

    Returns void

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

    Parameters

    Returns void

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

    Returns void

Legend

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

Settings

Theme