Button
Contains information about a specific button on a Gamepad.
Button objects are created automatically by the Gamepad as they are needed.
Constructor
new Button(pad, index, [isPressed])
Parameters
| name | type | optional | default | description |
|---|---|---|---|---|
| pad | Phaser.Input.Gamepad.Gamepad | No | A reference to the Gamepad that this Button belongs to. | |
| index | number | No | The index of this Button. | |
| isPressed | boolean | Yes | false | Whether or not the button is already being pressed at creation time. This prevents the Button from emitting spurious 'down' events at first update. |
Scope: static
Source: src/input/gamepad/Button.js#L10
Since: 3.0.0
Public Members
events
events: Phaser.Events.EventEmitter
Description:
An event emitter to use to emit the button events.
Source: src/input/gamepad/Button.js#L41
Since: 3.0.0
index
index: number
Description:
The index of this Button.
Source: src/input/gamepad/Button.js#L50
Since: 3.0.0
pad
pad: Phaser.Input.Gamepad.Gamepad
Description:
A reference to the Gamepad that this Button belongs to.
Source: src/input/gamepad/Button.js#L32
Since: 3.0.0
pressed
pressed: boolean
Description:
Is the Button being pressed down or not?
Source: src/input/gamepad/Button.js#L80
Since: 3.0.0
threshold
threshold: number
Description:
Can be set for analogue buttons to enable a 'pressure' threshold,
before a button is considered as being 'pressed'.
Source: src/input/gamepad/Button.js#L69
Since: 3.0.0
value
value: number
Description:
Between 0 and 1.
Source: src/input/gamepad/Button.js#L59
Since: 3.0.0
Public Methods
destroy
<instance> destroy()
Description:
Destroys this Button instance and releases external references it holds.
Source: src/input/gamepad/Button.js#L129
Since: 3.10.0