Tarnadas / net64plus

Super Mario 64 Online tool
MIT License
224 stars 39 forks source link

Feature/character switching #117

Closed ColinT closed 4 years ago

ColinT commented 4 years ago

Closes #63

This is currently not ready for merge. I am just putting this on the radar since the dev branch is active to prevent overlapping development.

This PR introduces support for switching characters via keyboard and XInput gamepads.

Global keyboard shortcuts are supported via Electron's globalShortcut. Local keyboard shortcuts are supported via electron-localshortcut. Gamepad supported is provided via the Gamepad API.

Also, is there an auto-formatter being used for this project? My personal code style is significantly different from the source. If you provide me a guideline or settings I will happily configure my formatter to comply.

ColinT commented 4 years ago

I've finished writing the features I wanted implemented. This now includes future support for combination and multiple hotkeys for the same shortcut. All non-modifier Electron accelerators are now supported, instead of just alphanumeric keys.

I have fixed all relevant eslint errors with one major exception: 42:17 error Do not use findDOMNode react/no-find-dom-node https://github.com/ColinT/net64plus/blob/229e3feb4d8f9c99a17da87b99d1596694060b36/src/renderer/components/buttons/HotkeyButton.tsx#L42

HotkeyButton relies on findDOMNode to detect when a click is performed outside of its node, and deactivate. This was the best solution I could find, but I am not that familiar with React. Feel free to make a suggestion for this if you have one.

This PR is fairly hefty so feel free to ask for any clarifications or additional inline comments should you feel it to be beneficial.