Class: Gamepad

Input. Gamepad

new Gamepad()

Create a new gamepad.

This constructor should not be used: instead, get a gamepad from the Input.gamepads array.

Source:
  • gamepad.js, line 39

Members

<static, readonly> Axis :Number

Enum for gamepad axes

Type:
  • Number
Properties:
Name Type Default Description
NONE Number 0
X Number 1
Y Number 2
Source:
  • gamepad.js, line 87

<static, readonly> Button :Number

Enum for gamepad buttons.

Type:
  • Number
Properties:
Name Type Default Description
NONE Number 0
A Number 1
Source:
  • gamepad.js, line 99

<readonly> numberOfAxis

The number of axis.

Source:
  • gamepad.js, line 52

<readonly> numberOfButtons

The number of buttons.

Source:
  • gamepad.js, line 45

talkActivationButton

The button to activate talk.

Source:
  • gamepad.js, line 57

Methods

getAxis(axis) → {Number}

Get the value of the specified axis.

Parameters:
Name Type Description
axis Input.Gamepad.Axis

The axis: one of the Gamepad.Axis enum.

Source:
  • gamepad.js, line 66
Returns:

Value of the axis.

Type
Number

isButtonPressed(button) → {Boolean}

Get the whether specified button is pressed.

Parameters:
Name Type Description
button Input.Gamepad.Button

The button: one of the Gamepad.Button enum.

Source:
  • gamepad.js, line 77
Returns:

true when the button is pressed, false otherwise.

Type
Boolean