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

Advanced navigation #58

Open
umut-sahin opened this issue Jul 10, 2024 · 4 comments
Open

Advanced navigation #58

umut-sahin opened this issue Jul 10, 2024 · 4 comments

Comments

@umut-sahin
Copy link

First of all, thanks for the lovely crate 🫶

I haven't seen anything about UI navigation with keyboard or controller input. I don't think it's supported in bevypunk either.

So I have a few questions:

  • Is it supported in any form?
  • If not, is it planned to be supported?
  • If the answer is no to either, can it be worked around?

I find this pretty critical, especially for handheld gaming consoles like Steam Deck. There is also the fact that pretty much all major games support UI navigation with keyboard. In the end, it would be great to have it in bevy_lunex as well!

(btw, https://github.com/nicopap/ui-navigation is a good example of what this issue is about)

@badcodecat
Copy link
Contributor

badcodecat commented Jul 12, 2024

Some additional resources that might be helpful:
UI navigation RFC for bevy, by the same author of ui-navigation: bevyengine/bevy#5378
Bevy pull request for UI keyboard navigation: bevyengine/bevy#8882
Gamepad support in bevy_ui by mouse emulation: bevyengine/bevy#6553

(Also note that the mentioned ui-navigation doesn't support bevy 0.13 or 0.14, see nicopap/ui-navigation#41)
(Edit, see also the up-to-date https://github.com/rparrett/bevy-alt-ui-navigation-lite)

@IDEDARY
Copy link
Collaborator

IDEDARY commented Jul 14, 2024

I have just merged gamepad support to Lunex (v0.2.2 or bleeding edge "Dev"). You can now move cursor with your gamepad.

I changed the current cursor implementation to account for gamepad controlled movement. I have completely ditched default mod picking input plugin and wrote a custom one, so now each Cursor2d acts as a virtual pointer instead.

Migration

Now each Cursor2d requires this bundle for picking to work

PointerBundle::new(PointerId::Custom(pointer::Uuid::new_v4())),

Changes

  • Added GamepadCursor marker component, that you can add to your cursor to make it pull data from gamepad.

Future plans

  • Add "dynamic cursor" component that supports both mouse and gamepad depending on what changed last.
  • Add support for GamepadCursorMode::Snap which changes the behavior of the cursor from "free hand movement" to "snap to the next node", which is probably preferred for Games targeting controller directly.

@badcodecat
Copy link
Contributor

Are there any future plans for keyboard navigation support?

@IDEDARY
Copy link
Collaborator

IDEDARY commented Jul 14, 2024

Once cursor snapping is implemented, it will be trivial to map the input events to keyboard presses.

All that would need to be done is to make a system that listens to button presses and writes events.

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

3 participants