1 decade ago by jeffreycheng
Hello good fellows! I have a code here that allows me to use a steering wheel for a regular browser game. I want to use it for ImpactJS but I am quite confused with what to put into the input.js file. This gamepad api works with firefox's nightly. How do I put it in input.js properly? I'm not sure where to place the event listener and other things.
According to https://wiki.mozilla.org/GamepadAPI
For the Axis Events
According to https://wiki.mozilla.org/GamepadAPI
For the Axis Events
<div id="gamepads"></div>
<script>
function axisHandler(event, pressed) {
var gamepads = document.getElementById("gamepads"),
gamepadId = event.gamepad.id,
axis = event.axis,
value = event.value;
gamepads.innerHTML += " Gamepad Axis Move (id=" + gamepadId +
", axis=" + axis +
", value=" + value + ")";
}
window.addEventListener("MozGamepadAxisMove", axisHandler, false);
</script>
