changed getGamepads for refreshGamepads method
This commit is contained in:
@ -92,8 +92,8 @@ class Gamepad {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getGamepads() {
|
refreshGamepads() {
|
||||||
return navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);
|
this.gamepads = navigator.getGamepads ? navigator.getGamepads() : (navigator.webkitGetGamepads ? navigator.webkitGetGamepads() : []);
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveGamepad() {
|
getActiveGamepad() {
|
||||||
@ -124,7 +124,7 @@ class Gamepad {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.gamepads = this.getGamepads();
|
this.refreshGamepads();
|
||||||
for (let gamepadIndex = 0; gamepadIndex < this.gamepads.length; gamepadIndex++) {
|
for (let gamepadIndex = 0; gamepadIndex < this.gamepads.length; gamepadIndex++) {
|
||||||
const gamepad = this.gamepads[gamepadIndex];
|
const gamepad = this.gamepads[gamepadIndex];
|
||||||
if (gamepad) {
|
if (gamepad) {
|
||||||
@ -209,7 +209,8 @@ class Gamepad {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateVisualStatus() {
|
updateVisualStatus() {
|
||||||
this.gamepads = this.getGamepads();
|
this.refreshGamepads();
|
||||||
|
|
||||||
// ensure that a gamepad is currently active
|
// ensure that a gamepad is currently active
|
||||||
if (!this.activeGamepad) {
|
if (!this.activeGamepad) {
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user