Allow Users to Customize Key Mapping #136
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Having the directional buttons on the right and action buttons on the left did not feel natural.
This PR allows users to customize what keys are mapped to each player's controller buttons and saves those changes to localStorage. Although it wasn't made to fix the issue, it does adequately address #65.
It's definitely not as cleanly implemented as I would like, but it's a joy to play with the keys I prefer. I didn't want to hold out from others being able to have the same experience.
Note
If browser does not allow access to localStorage, it will silently fail and maintain the default key mapping. We could get past that, but I'm not sure it would maintain those preferences past a refresh or ROM change.
I was only able to test these changes on recent versions of Chrome and Firefox. Bandwidth limitations kept me from downloading other browsers for testing.