bytestring-net / bevy_lunex

Blazingly fast path based retained layout engine for Bevy entities, built around vanilla Bevy ECS.
https://bytestring-net.github.io/bevy_lunex/
Apache License 2.0
478 stars 18 forks source link

Advanced navigation #58

Open umut-sahin opened 3 weeks ago

umut-sahin commented 3 weeks ago

First of all, thanks for the lovely crate :heart_hands:

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:

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 commented 3 weeks ago

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

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

IDEDARY commented 2 weeks ago

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

Future plans

badcodecat commented 2 weeks ago

Are there any future plans for keyboard navigation support?

IDEDARY commented 2 weeks ago

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.