Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/input/gamepad/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ var Events = require('./events');
*
* @param {Phaser.Input.Gamepad.Gamepad} pad - A reference to the Gamepad that this Button belongs to.
* @param {number} index - The index of this Button.
* @param {boolean} isPressed - Whether or not the button is already being pressed at creation time. This prevents the Button from emitting spurious 'down' events at first update.
*/
var Button = new Class({

initialize:

function Button (pad, index)
function Button (pad, index, isPressed)
{
/**
* A reference to the Gamepad that this Button belongs to.
Expand Down Expand Up @@ -82,7 +83,7 @@ var Button = new Class({
* @default false
* @since 3.0.0
*/
this.pressed = false;
this.pressed = isPressed;
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/input/gamepad/Gamepad.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ var Gamepad = new Class({

for (var i = 0; i < pad.buttons.length; i++)
{
buttons.push(new Button(this, i));
buttons.push(new Button(this, i, (pad.buttons[i].value >= 0.5)));
}

/**
Expand Down