Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supporting non-standard layouts, scoped keypresses, composing gamepads? #9

Open
philschatz opened this issue Jan 14, 2019 · 1 comment

Comments

@philschatz
Copy link

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 standard layout
    • 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

@shroudedcode
Copy link
Owner

shroudedcode commented Jan 14, 2019

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 Show labels based on gamepad model #3 and Allow custom 2D vector implementation to be used #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants