Interface: GamepadEventsMap

Phaser.Types.Input.Gamepad. GamepadEventsMap

Methods


down(index, value, button)

The Gamepad Button Down Event.

This event is dispatched by a Gamepad instance when a button has been pressed on it.

Listen to this event from a Gamepad instance. Once way to get this is from the pad1, pad2, etc properties on the Gamepad Plugin: this.input.gamepad.pad1.on('down', listener).

Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.

You can also listen for a DOWN event from the Gamepad Plugin. See the BUTTON_DOWN event for details.

Parameters:
Name Type Description
index integer

The index of the button that was pressed.

value number

The value of the button at the time it was pressed. Between 0 and 1. Some Gamepads have pressure-sensitive buttons.

button Phaser.Input.Gamepad.Button

A reference to the Button which was pressed.

Since: 3.10.0
Source: src/input/gamepad/events/GAMEPAD_BUTTON_DOWN_EVENT.js (Line 28)

up(index, value, button)

The Gamepad Button Up Event.

This event is dispatched by a Gamepad instance when a button has been released on it.

Listen to this event from a Gamepad instance. Once way to get this is from the pad1, pad2, etc properties on the Gamepad Plugin: this.input.gamepad.pad1.on('up', listener).

Note that you will not receive any Gamepad button events until the browser considers the Gamepad as being 'connected'.

You can also listen for an UP event from the Gamepad Plugin. See the BUTTON_UP event for details.

Parameters:
Name Type Description
index integer

The index of the button that was released.

value number

The value of the button at the time it was released. Between 0 and 1. Some Gamepads have pressure-sensitive buttons.

button Phaser.Input.Gamepad.Button

A reference to the Button which was released.

Since: 3.10.0
Source: src/input/gamepad/events/GAMEPAD_BUTTON_UP_EVENT.js (Line 28)