Create a new GamepadDisplay instance
The config to use for the gamepad display
Optional
apiWrapper: GamepadApiWrapperProtected
apiProtected
axisProtected
btnProtected
configCleanup function to remove all event listeners created by the GamepadDisplay Call this function before removing the gamepad display from the DOM or deleting the GamepadDisplay instance to prevent memory leaks
Function called by default when any gamepad buttons change (called separately for each button (as configured in this GamepadDisplay)) If you specify your own buttonDisplayFunction in the config, this function won't get called. Instead, you can call this function with the same parameters as passed to the buttonDisplayFunction if you want to keep the default behaviour (and then you can add your own custom behaviour on top)
The config for the button that has changed as configured in buttons
The new value of the button
Whether the button is currently being touched (unused, but included for consistency with the ButtonDisplayFunction signature)
Whether the button is currently being pressed (unused, but included for consistency with the ButtonDisplayFunction signature)
The changes that have occurred since the last update
The index of the button that has changed (unused, but included for consistency with the ButtonDisplayFunction signature)
Function called by default when the gamepad axies change for a joystick (as configured in this GamepadDisplay) If you specify your own joystickDisplayFunction in the config, this function won't get called. Instead, you can call this function with the same parameters as passed to the joystickDisplayFunction if you want to keep the default behaviour (and then you can add your own custom behaviour on top)
The config for the joystick that has changed (as configured in sticks)
Protected
displayThis function is registered as the callback for GamepadApiWrapper.onGamepadButtonChange it calls the buttonDisplayFunction (if specified) or the DisplayGamepad.defaultButtonDisplayFunction otherwise for every button that has changed since the last update
The index of the gamepad that has changed
The new state of the gamepad as reported by the browser / GamepadApiWrapper.onGamepadButtonChange
Protected
displayThis function is registered as the callback for GamepadApiWrapper.onGamepadAxisChange it calls the joystickDisplayFunction (if specified) or the DisplayGamepad.defaultJoystickDisplayFunction otherwise for each configured joystick with axies that have changed
The index of the gamepad that has changed
The new state of the gamepad as reported by the browser / GamepadApiWrapper.onGamepadAxisChange
An array of booleans, where each true indicates that the corresponding axis has changed since the last update
Generated using TypeDoc
Class to handle displaying the state of a gamepad on the screen. This class will not draw anything to the screen. Instead it will update the classes / transforms of the elements you provide to represent the buttons and axes of the gamepad. See the examples for more information.