Merge pull request #2471 from cwleonard/gamepad

Gamepad problems in Google Chrome
This commit is contained in:
Richard Davey 2016-06-02 15:46:03 +01:00
commit 8da3395407

View file

@ -252,6 +252,11 @@ Phaser.Gamepad.prototype = {
*/ */
_pollGamepads: function () { _pollGamepads: function () {
if (!this._active)
{
return;
}
if (navigator['getGamepads']) if (navigator['getGamepads'])
{ {
var rawGamepads = navigator.getGamepads(); var rawGamepads = navigator.getGamepads();
@ -291,6 +296,11 @@ Phaser.Gamepad.prototype = {
} }
} }
for (var g = 0; g < this._gamepads.length; g++)
{
this._gamepads[g]._rawPad = this._rawPads[g];
}
if (gamepadsChanged) if (gamepadsChanged)
{ {
var validConnections = { rawIndices: {}, padIndices: {} }; var validConnections = { rawIndices: {}, padIndices: {} };