Created
August 1, 2012 20:38
-
-
Save cfjedimaster/3230529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateStatus() | |
{ | |
window.webkitRequestAnimationFrame(updateStatus); | |
var gamepads = navigator.webkitGamepads; | |
var data = ''; | |
for (var padindex = 0; padindex < gamepads.length; ++padindex) | |
{ | |
var pad = gamepads[padindex]; | |
var i; | |
if (!pad) continue; | |
data += '<pre>' + pad.index + ": " + pad.id + "<br/>"; | |
for (i = 0; i < pad.buttons.length; ++i) | |
data += "button" + i + ": " + pad.buttons[i] + "<br/>"; | |
for (i = 0; i < pad.axes.length; ++i) | |
data += "axis" + i + ": " + pad.axes[i] + "<br/>"; | |
} | |
document.body.innerHTML = data; | |
} | |
window.webkitRequestAnimationFrame(updateStatus); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment