pokerogue
pokerogue copied to clipboard
Menu - Gamepad/Keyboard menu
First iteration of the gamepad menu, for now, there is only the 2 "old" gamepad related entry + the new default gamepad selection.
I don't know if you prefer multiple small working PR with features added in this menu or if you want a big PR with all the gamepad related feature i'd like to implement:
- Gamepad selection
- Gamepad rebinding
- Activate/Deactivate turbo (holding a button to repeat the input)
- [... will maybe have more idea later ...]
I've added some hidden mecanism like:
-
There is 2 gamepad, we are using the gamepad2 as the chosen gamepad. if we reload, this is still this gamepad that will be used.
-
There is 2 gamepad, we are using the gamepad2 as the chosen gamepad. if we disconnect the gamepad2, it fallback automatically to the gamepad1
-
There is no gamepad, we plug a new gamepad, at the very first button pressed, this gamepad will be the new chosen gamepad
-
on any event from the gamepads, the list of gamepads in the menu is updated
-
on any event from the gamepads, the chosen gamepad in the menu is updated
-
It's not yet there, but the way it's coded, will allow to have custom binding based on the chosen gamepad
[Main post updated]
What about mobile controls ? if you mean a tab dedicated to it, yes it's possible, if you mean rebinding the touch control, the issue is that the touch control, as it's coded for the moment is a virtual keyboard, we assign a touch event to a key from the keyboard.
in this v1, i'll just do the rebinding of the gamepad, but when it's done, i'm sure it will be easy to adapt the code to the keyboard, and thus, iterate on the mobile version.
and if the worry was about the renaming in the enum of cycle_shiny and cycle_form, don't worry, there is no visual changed
UI/UX is not always the easiest thing ahah but i progress !
V1 of the key remapping is working !
Gamepad menu is done. the code need some cleanup/refactor/renaming though
I've added a lot of test case to be sure everything works fine. maybe there will be more case i did not handle, manual test will be needed so i can replicate them in the unit test.
on the keyboard mapping, you can press DELETE to remove a binding
It's LB & RB to navigate in the manu tabs, F & R by default with keyboard
there is not yet an image to say "No button assigned" so for now, it displays 0
in your tests, if you mess with the mapping: delete in your local storage:
- customKeyboardMappings for keyboard mapping
- customMapping for gamepad mapping
you can test here: https://pokerogue.greenlamp.ovh/
username: test password: testtest
on mobile, i've displayed the buttons we had in the starter selection since it's needed to navigate in the menu
TODO:
- ~~use the button action to change a bind instead of the button right~~
- ~~rework the swap to just delete the button source instead of asking to swap both buttons~~
- ~~add a button to "reset to default"~~
- ~~prevent the rebind of the main keys like the arrows, escape and enter~~
- ~~prevent the deletion of the last bind of an action~~
- ~~display the alt button as an icon if the main bind has been deleted~~
- ~~add Actions UI to know how to reset & delete~~
test instance: https://pokerogue.greenlamp.ovh/
TODO:
- ~~fix the cursor glitch when we scroll + delete~~
Closing this PR to create a cleaner one.