Trouv / willos-graveyard

Sokoban puzzle game made for GMTK 2021 game jam - Joined Together
3 stars 0 forks source link

Gamepad menu navigation #95

Open Trouv opened 1 year ago

Trouv commented 1 year ago

Try out bevy_ui_navigation for gamepad support. We may also want to alter the current UiAction API to support this, and maybe use the UI features of leafwing_input_manager as a replacement.

Trouv commented 1 year ago

Some thoughts on how to break this down:

NavigationPlugin

NavigatableActionPlugin\<A>

Other

PRs

Trouv commented 1 year ago

Okay, after trying for a little bit, that first PR may not be worth it. There's a couple issues with the ActionStateDriver that we need to use to use leafwing w/ UI buttons:

  1. You can't use the ActionState as a resource
  2. The button only works on_pressed, not on released (no changing your mind by dragging your mouse off the before unclicking)
  3. Most importantly, the driver seems to use just the variant of the action you chose for it, rather than its exact value. For internal types, it seems to use the default implementation. So, when I give a button a ActionStateDriver { action: LevelSelectAction(LevelSelect::Index(18)), .. }, the actual action it performs is LevelSelectAction(LevelSelect::default())

I'll just continue to use UiAction for now. We should still be able to use leafwing for navigation input though