gamepad bugs in Chrome

fixes issues with being unable to connect a gamepad in Chrome and losing
the gamepad when focus is lost to the game
This commit is contained in:
Casey Leonard 2016-05-07 19:07:16 -04:00
parent 5e97f10c86
commit 9ede913609

View file

@ -252,6 +252,11 @@ Phaser.Gamepad.prototype = {
*/
_pollGamepads: function () {
if (!this._active)
{
return;
}
if (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)
{
var validConnections = { rawIndices: {}, padIndices: {} };