taisel / GameBoy-Online

JavaScript GameBoy Color emulator.
http://taisel.github.io/GameBoy-Online/
592 stars 174 forks source link

[Request] Gamepad Support #23

Open pc0hidq opened 5 years ago

pc0hidq commented 5 years ago

Hi,

I don't really know anything about coding but I have been using gb studio which bundled gameboy-online for it's weblauncher. I put out a small game using it but a lot of people were very confused by the lack of gamepad support.

I have a feeling that this code set will be used by many more people in the future. Would it be possible to add gamepad support? Are there any alternative html5 emulators that do this?

bbbbbr commented 5 years ago

If you don't mind using a fork, I've modified the version packaged with GB Studio to use the html5 gamepad API.

https://github.com/bbbbbr/gb-studio/tree/develop/appData/js-emulator

To use it outside of GB Studio you'd want to change this one line in js/other/controls.js (or fully define customControls in index.html)

FROM: var keys = customControls[key] ? customControls[key] : defaultKeys[key];
TO: var keys = defaultKeys[key];