Methods
hasDelta(playeropt) → {Boolean}
Returns if the state of the buttons has changed since the last update.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
player |
Number |
<optional> |
-1 | The gamepad to check for a delta, if -1, all are checked. |
- Source:
Returns:
If there was a change since the last update in button/axis states.
- Type
- Boolean
isDown(target, playeropt) → {Boolean}
Check if a button is pressed or held.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
String | The button to check if is down. | ||
player |
Number |
<optional> |
-1 | The gamepad to check, if -1, all are checked. |
- Source:
Returns:
isDown If the button is pressed or held.
- Type
- Boolean
isMoved(target, playeropt)
Returns a number representing if an axis has moved, 0 if not, (-1,0] or [0,1) otherwise.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
target |
String | |||
player |
Number |
<optional> |
-1 |
- Source:
off(type, target)
Remove the event listener from the button or axis.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The type of event to remove the listener for. |
target |
String | The button or axis to remove the listener for. |
- Source:
on(type, target, listener)
Set an event listender for a button or axis event.
Parameters:
Name | Type | Description |
---|---|---|
type |
String | The type of event to listen for. |
target |
String | The button or axis to listen to events for. |
listener |
function | Called with event data when the event occurs. |
- Source:
update()
Update the gamepad manager, this handles button/axis events,
as well as updating the internal state and setting up the delta.
- Source: