Gamepad
Index
Constructors
constructor
Returns Gamepad
Properties
publicconnected
publicevents
publicnavigatorGamepad
Methods
publicemit
Type parameters
- TEventName: EventKey<GamepadEvents>
Parameters
eventName: TEventName
event: GamepadEvents[TEventName]
Returns void
publicgetAxes
Gets the given axis value between -1 and 1. Values below MinAxisMoveThreshold are considered 0.
Parameters
axes: Axes
Returns number
publicgetButton
Gets the given button value between 0 and 1
Parameters
button: Buttons
Returns number
publicisButtonHeld
Tests if a certain button is held down. This is persisted between frames.
Parameters
button: Buttons
The button to query
threshold: number = 1
The threshold over which the button is considered to be pressed
Returns boolean
publicisButtonPressed
Whether or not the given button is pressed
Parameters
button: Buttons
The button to query
threshold: number = 1
The threshold over which the button is considered to be pressed
Returns boolean
publicoff
publicon
Type parameters
- TEventName: EventKey<GamepadEvents>
Parameters
eventName: TEventName
handler: Handler<GamepadEvents[TEventName]>
Returns Subscription
publiconce
Type parameters
- TEventName: EventKey<GamepadEvents>
Parameters
eventName: TEventName
handler: Handler<GamepadEvents[TEventName]>
Returns Subscription
publicupdate
Returns void
publicupdateAxes
Parameters
axesIndex: number
value: number
Returns void
publicupdateButton
Parameters
buttonIndex: number
value: number
Returns void
publicwasButtonPressed
Tests if a certain button was just pressed this frame. This is cleared at the end of the update frame.
Parameters
button: Buttons
Test whether a button was just pressed
threshold: number = 1
The threshold over which the button is considered to be pressed
Returns boolean
publicwasButtonReleased
Tests if a certain button was just released this frame. This is cleared at the end of the update frame.
Parameters
button: Buttons
Test whether a button was just released
Returns boolean
Gamepad holds state information for a connected controller. See Gamepads for more information on handling controller input.