Class Gamepad
Hierarchy (View Summary)
- Gamepad
Constructors
constructor
-
new Gamepad(
id: string,
index: number,
browserGamepad: any,
leftStickX?: number,
leftStickY?: number,
rightStickX?: number,
rightStickY?: number,
): GamepadInitializes the gamepad
Parameters
- id: string
The id of the gamepad
- index: number
The index of the gamepad
- browserGamepad: any
The browser gamepad
- leftStickX: number = 0
The x component of the left joystick
- leftStickY: number = 1
The y component of the left joystick
- rightStickX: number = 2
The x component of the right joystick
- rightStickY: number = 3
The y component of the right joystick
Returns Gamepad
- id: string
Properties
browser Gamepad
The browser gamepad
id
The id of the gamepad
index
The index of the gamepad
type
Specifies what type of gamepad this represents
StaticDUALSHOCK
Represents an Dual Shock controller
StaticGAMEPAD
Represents a gamepad controller
StaticGENERIC
Represents a generic controller
StaticPOSE_ ENABLED
Represents a pose-enabled controller
StaticXBOX
Represents an XBox controller
Accessors
is Connected
-
get isConnected(): boolean
Specifies if the gamepad has been connected
Returns boolean
left Stick
-
Gets the left joystick
Returns StickValues
right Stick
-
Gets the right joystick
Returns StickValues
Methods
dispose
-
Disposes the gamepad
Returns void
onleftstickchanged
-
Callback triggered when the left joystick has changed
Parameters
- callback: (values: StickValues) => void
callback to trigger
Returns void
- callback: (values: StickValues) => void
onrightstickchanged
-
Callback triggered when the right joystick has changed
Parameters
- callback: (values: StickValues) => void
callback to trigger
Returns void
- callback: (values: StickValues) => void
update
-
Updates the gamepad joystick positions
Returns void
Represents a gamepad