Supporting non-standard layouts, scoped keypresses, composing gamepads?
Hello, thanks for a great library and extensive tests! I have been using it to allow blind people to play video games with a gamepad.
I ran into a few limitations and after a failed attempt to add some of them to contro, I ended up writing some code that is similar to contro but has the following features:
- uses the standard layout to explicitly to buttons and sticks
- supports gamepads that do not use the
standardlayout- some browsers like Firefox do not provide a standard mapping
- uses mapping files to support non-standard gamepads
- allows checking if a specific button is available on the gamepad
- allows composing buttons, sticks, and even gamepads to make it easier to write games
- allows scoping the key presses so they only apply when the game is in focus (being played)
- allows disposing of keyboard buttons when they are no longer needed
I was not sure if some of those were problems others have run into and if you would be interested in a Pull Request to contro with those changes. If you are interested, I can create one and add tests.
Also, here is the README for the code.
Again, thanks for such an elegant library!
refs #2
Hello, thanks for a great library and extensive tests! I have been using it to allow blind people to play video games with a gamepad.
Thanks, Phil! That's awesome.
I was not sure if some of those were problems others have run into and if you would be interested in a Pull Request to contro with those changes.
Absolutely. I like your ideas and in fact I've been wanting to release a new major version of Contro for a while but just didn't really have the time for it. I also wasn't sure whether my changes would actually improve the library for game developers because I just don't work that much on games myself.
Here are some of the other things I wanted to change:
- make sure that there's only one way to achieve a thing (for example by removing button aliases)
- this includes finding one perfect way to reference gamepad buttons (something your changed in your code as well)
- implement #3 and #4
- rethink the general API design
- do classes really make sense?
- could the functions/properties be named in a better way?
- make it easier to use custom buttons/keys/etc.
- make it easier to extend Contro without changing its code
I want Contro to be the best JavaScript game control library out there. Would you be interested in helping me achieve that? You've already found a lot of problems I would have never thought of.
I've created a v3 branch that you can PR to (preferrably using multiple PRs for a better overview and easier reviewing). Feel free to make breaking changes if they improve the library.
Thanks again for the feedback! I'm looking forward to your contributions.