event_loop: wire F-key screen switching with ScreenView
Create overlay screens vec (ConsciousScreen, SubconsciousScreen, UnconsciousScreen, ThalamusScreen). F-keys switch active_screen. Screen tick() called during render phase with pending key event. Screen actions (Switch, Hotkey) applied after draw. Interact (F1) still draws via App::draw_main(). Overlay screens draw via ScreenView::tick(). State persists across switches. Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
927cddd864
commit
8418bc9bc9
2 changed files with 58 additions and 9 deletions
|
|
@ -244,7 +244,7 @@ pub enum ScreenAction {
|
|||
}
|
||||
|
||||
/// A screen that can draw itself and handle input.
|
||||
pub(crate) trait ScreenView {
|
||||
pub(crate) trait ScreenView: Send {
|
||||
fn tick(&mut self, frame: &mut ratatui::Frame, area: ratatui::layout::Rect,
|
||||
key: Option<ratatui::crossterm::event::KeyEvent>, app: &App) -> Option<ScreenAction>;
|
||||
fn label(&self) -> &'static str;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue