#Issue with keyboard input while using bevy_ratatui

14 messages · Page 1 of 1 (latest)

smoky mirage
#

BACKGROUND: I'm making a tab-based navigation system where the Tab key is used to go to the next (left-to-right) tab.
The code is based on the official bevy_ratatui example https://github.com/joshka/bevy_ratatui/blob/main/examples/demo.rs
ISSUE: Tabs switch really fast while the key is pressed, it makes it impossible to go the adjacent tabs, i want the tab to cycle once, when the key is pressed

Here is the full source code: https://github.com/Vinermy/astray/tree/bevy-migration

GitHub

A rust crate to use Ratatui in a Bevy App. Contribute to joshka/bevy_ratatui development by creating an account on GitHub.

GitHub

Contribute to Vinermy/astray development by creating an account on GitHub.

molten tartan
#

I didn't look at the code but it sounds to me that a few frames pass when the tab is pressed down

#

Where's the KeyEvent writer?

#

I think it's sending an event whenever the key is down and not just when it was up the previous frame

molten tartan
#

Who's firing KeyEvent?

#

Worst case you can just make a boolean resource that says if tab was pressed the previous frame then only act if it wasnt

dusty kestrel
smoky mirage
dusty kestrel
#

I'd go with Press.