mirror of
https://github.com/photonstorm/phaser
synced 2025-02-17 06:28:30 +00:00
Merge pull request #958 from renatodarrigo/patch-2
Fix rawpad button array to support win and linux
This commit is contained in:
commit
de270908de
1 changed files with 9 additions and 8 deletions
|
@ -190,24 +190,26 @@ Phaser.SinglePad.prototype = {
|
|||
|
||||
for (var i = 0; i < this._buttonsLen; i++)
|
||||
{
|
||||
if (this._rawPad.buttons[i].value !== this._buttons[i].value)
|
||||
var rawButtonVal = isNaN(this._rawPad.buttons[i]) ? this._rawPad.buttons[i].value : this._rawPad.buttons[i];
|
||||
|
||||
if (rawButtonVal !== this._buttons[i].value)
|
||||
{
|
||||
if (this._rawPad.buttons[i].value === 1)
|
||||
if (rawButtonVal === 1)
|
||||
{
|
||||
this.processButtonDown(i, this._rawPad.buttons[i].value);
|
||||
this.processButtonDown(i, rawButtonVal);
|
||||
}
|
||||
else if (this._rawPad.buttons[i].value === 0)
|
||||
else if (rawButtonVal === 0)
|
||||
{
|
||||
this.processButtonUp(i, this._rawPad.buttons[i].value);
|
||||
this.processButtonUp(i, rawButtonVal);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.processButtonFloat(i, this._rawPad.buttons[i].value);
|
||||
this.processButtonFloat(i, rawButtonVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
for (var j = 0; j < this._axesLen; j++)
|
||||
{
|
||||
var axis = this._rawPad.axes[j];
|
||||
|
@ -221,7 +223,6 @@ Phaser.SinglePad.prototype = {
|
|||
this.processAxisChange( { axis: j, value: 0 } );
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
this._prevTimestamp = this._rawPad.timestamp;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue