Create a new GamepadApiWrapper
The configuration options for this wrapper
Protected
_getProtected
_requestProtected
axisProtected
buttonProtected
currentProtected
gamepadProtected
gamepadProtected
gamepadProtected
gamepadProtected
updateProtected
checkProtected
checkProtected
checkReturns the result of navigator.getGamepads() from the last update
If true, navigator.getGamepads() will be called inmediately before returning, if gamepad changes happened since the last update, this will cause those change events to fire.
An array of gamepad objects, or an empty array if the gamepad api is not supported
returns the value of navigator.getGamepads() in a cross-browser compatible way
An array of gamepad objects (including any emulated gamepads if the GamepadEmulator was set up), or an empty array if the gamepad api is not supported or gampad permissions haven't been granted.
offGamepadAxisChange: remove an existing event listener for when a gamepad axis changes
The calback function to remove (must be the same function passed to onGamepadAxisChange())
offGamepadButtonChange: remove an existing event listener for when a gamepad button changes
The calback function to remove (must be the same function passed to onGamepadButtonChange())
remove an existing event listener for when a gamepad (either real or emulated) is connected
The calback function to remove (must be the same function passed to onGamepadConnect())
remove an existing event listener for when a gamepad (either real or emulated) is disconnected
The calback function to remove (must be the same function passed to onGamepadDisconnect())
add an event listener for each time a gamepad axis changes. The callback function will be called with the gamepad index, the gamepad object, and a boolean array of the changed axes, The callback is called separately for each gamepad where axes have changed.
The calback function to call when a gamepad axis state changes
onGamepadButtonChange add an event listener for each time a gamepad button changes. The callback function will be called with the gamepad index, the gamepad object, and a array of the changed buttons containing details about how the button transitioned or false if the button state didn't change this frame. Callback is called separately for each gamepad where buttons have changed.
The calback function to call when a gamepad button state changes
Add an event listener for when a gamepad (either real or emulated) is connected
The calback function to call when a gamepad is connected
add an event listener for when a gamepad (either real or emulated) is disconnected
The calback function to call when a gamepad is disconnected
Changes the button configs used by the wrapper (takes effect after the next gamepad update)
Protected
tick
Wrapper for the Gamepad API that smooths out browser inconsistancies. Exposes changes to gamepads, buttons and axes as events.