interface DisplayGamepadConfig {
    buttonDisplayFunction?: ButtonDisplayFunction;
    buttons?: (undefined | null | GamepadDisplayButton)[];
    gamepadIndex: number;
    joystickDisplayFunction?: JoystickDisplayFunction;
    moveDirectionHighlightClass?: string;
    pressedHighlightClass?: string;
    sticks?: GamepadDisplayJoystick[];
    touchedHighlightClass?: string;
}

Properties

buttonDisplayFunction?: ButtonDisplayFunction

If provided, this function will be called for each button with a state change (pressed, touched, released, etc...)

buttons?: (undefined | null | GamepadDisplayButton)[]

Configuration for Buttons and Variable Pressure Buttons (eg: shoulder triggers) to represent in the gamepad display

  • The index of the button in the array corresponds to the index of the button as returned by the browser gamepad api.
  • Add null in the array for any button you don't want to track.
gamepadIndex: number

The index of the gamepad this Gamepad Display should track as returned from navigator.GetGamepads()

joystickDisplayFunction?: JoystickDisplayFunction

If provided, this function will be called when the gamepad axies change for a joystick instead of the default display function.

moveDirectionHighlightClass?: string

The class to add to the corresponding direction indicator element when a gamepad joystick is moved in a direction or a variable button is pressed

pressedHighlightClass?: string

The class to add to the corresponding highlight element when a gamepad button is pressed

Configuration for Joysticks to represent in the gamepad display (based on gamepad axes indecies as as returned by the browser gamepad api)

touchedHighlightClass?: string

The class to add to the corresponding highlight element when a gamepad button is touched (whether or not its pressed)