When w3c "standard" gamepad mapping is available the buttons will map to the expected locations of A/B/Start/Select, otherwise the first 4 (non-axis) buttons found map to A/B/Select/Start. Chrome seems to do a better job at detecting gamepad mapping than Firefox.
Gamepad support co-exists and does not interfere with keyboard controls. Polling only starts if a button is pressed on gamepad the window has foxus. Polling will stop if the gamepad disconnects or the emulator has destroy called, and can resume again if a new rom is loaded.
The gamepad code is almost all contained in a Gamepad class.
Adds HTML5 gamepad support to demo.js.
When w3c "standard" gamepad mapping is available the buttons will map to the expected locations of A/B/Start/Select, otherwise the first 4 (non-axis) buttons found map to A/B/Select/Start. Chrome seems to do a better job at detecting gamepad mapping than Firefox.
Gamepad support co-exists and does not interfere with keyboard controls. Polling only starts if a button is pressed on gamepad the window has foxus. Polling will stop if the gamepad disconnects or the emulator has destroy called, and can resume again if a new rom is loaded.
The gamepad code is almost all contained in a
Gamepad
class.Testable here: https://bbbbbr.github.io/binjgb/demo/demo.html