Class: Button

Phaser.Input.Gamepad. Button

Contains information about a specific button on a Gamepad. Button objects are created automatically by the Gamepad as they are needed.


new Button(pad, index)

Parameters:
Name Type Description
pad Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Button belongs to.

index integer

The index of this Button.

Since: 3.0.0
Source: src/input/gamepad/Button.js (Line 10)

Members


events :Phaser.Events.EventEmitter

An event emitter to use to emit the button events.

Type:
Since: 3.0.0
Source: src/input/gamepad/Button.js (Line 38)

index :integer

The index of this Button.

Type:
  • integer
Since: 3.0.0
Source: src/input/gamepad/Button.js (Line 47)

pad :Phaser.Input.Gamepad.Gamepad

A reference to the Gamepad that this Button belongs to.

Type:
Since: 3.0.0
Source: src/input/gamepad/Button.js (Line 29)

pressed :boolean

Is the Button being pressed down or not?

Type:
  • boolean
Since: 3.0.0
Default Value:
  • false
Source: src/input/gamepad/Button.js (Line 77)

threshold :number

Can be set for analogue buttons to enable a 'pressure' threshold, before a button is considered as being 'pressed'.

Type:
  • number
Since: 3.0.0
Default Value:
  • 1
Source: src/input/gamepad/Button.js (Line 66)

value :number

Between 0 and 1.

Type:
  • number
Since: 3.0.0
Default Value:
  • 0
Source: src/input/gamepad/Button.js (Line 56)

Methods


destroy()

Destroys this Button instance and releases external references it holds.

Since: 3.10.0
Source: src/input/gamepad/Button.js (Line 126)