Create a new GamepadDisplay instance
The config to use for the gamepad display
Optional
apiWrapper: GamepadApiWrapper(OPTIONAL) The gamepad api will use this GamepadApiWrapper instance to listen for gamepad events, otherwise it will create a new gamepad wrapper under the hood.
Protected
apiProtected
configProtected
displayThis function is registered as the callback for () it calls the DisplayGamepadConfig.buttonDisplayFunction (if specified) or the GamepadDisplay.DefaultButtonDisplayFunction otherwise for every button that has changed since the last update
The new state of the gamepad as reported by the browser / GamepadApiWrapper.onGamepadButtonChange
Protected
displayThis function is registered as the callback for () it calls the DisplayGamepadConfig.joystickDisplayFunction (if specified) or the GamepadDisplay.DefaultJoystickDisplayFunction otherwise for each configured joystick with axies that have changed
Cleanup 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
Readonly
DefaultFunction called by default when any gamepad buttons change (called separately for each button (as configured in this GamepadDisplay)) If you specify your own DisplayGamepadConfig.buttonDisplayFunction in the config, this function won't get called. Instead, you can call this function with the same parameters as passed to the DisplayGamepadConfig.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 DisplayGamepadConfig.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)
Readonly
DefaultFunction called by default when the gamepad axies change for a joystick (as configured in this GamepadDisplay) If you specify your own DisplayGamepadConfig.joystickDisplayFunction in the config, this function won't get called. Instead, you can call this function with the same parameters as passed to the DisplayGamepadConfig.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 DisplayGamepadConfig.sticks)
The new x axis value
The new y axis value
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.