Skip to content

Commit 9ede913

Browse files
committed
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
1 parent 5e97f10 commit 9ede913

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/input/Gamepad.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ Phaser.Gamepad.prototype = {
252252
*/
253253
_pollGamepads: function () {
254254

255+
if (!this._active)
256+
{
257+
return;
258+
}
259+
255260
if (navigator['getGamepads'])
256261
{
257262
var rawGamepads = navigator.getGamepads();
@@ -291,6 +296,11 @@ Phaser.Gamepad.prototype = {
291296
}
292297
}
293298

299+
for (var g = 0; g < this._gamepads.length; g++)
300+
{
301+
this._gamepads[g]._rawPad = this._rawPads[g];
302+
}
303+
294304
if (gamepadsChanged)
295305
{
296306
var validConnections = { rawIndices: {}, padIndices: {} };

0 commit comments

Comments
 (0)