mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
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:
parent
5e97f10c86
commit
9ede913609
1 changed files with 10 additions and 0 deletions
|
@ -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: {} };
|
||||||
|
|
Loading…
Reference in a new issue