-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area: inputInput related issueInput related issueenhancementRequest for a new featureRequest for a new featuregood first issueGood for newcomersGood for newcomers
Description
update: function (dt) {
var pads = this.poll();
var i, len = pads.length;
for (i = 0;i < len; i++) {
this.previous[i] = this.current[i];
this.current[i] = pads[i];
}
},
poll: function () {
var pads = [];
if (this.gamepadsSupported) {
var padDevices = navigator.getGamepads ? navigator.getGamepads() : navigator.webkitGetGamepads();
var i, len = padDevices.length;
for (i = 0; i < len; i++) {
if (padDevices[i]) {
pads.push({
map: this.getMap(padDevices[i]),
pad: padDevices[i]
});
}
}
}
return pads;
},
When poll() gets called, it allocates a new array to store the current gamepad state.
Metadata
Metadata
Assignees
Labels
area: inputInput related issueInput related issueenhancementRequest for a new featureRequest for a new featuregood first issueGood for newcomersGood for newcomers