centralized general movement
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// src/state/pages/intro.rs
|
||||
use crate::movement::MovementAction;
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct IntroState {
|
||||
@@ -23,3 +24,25 @@ impl IntroState {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntroState {
|
||||
pub fn handle_movement(&mut self, action: MovementAction) -> bool {
|
||||
match action {
|
||||
MovementAction::Next | MovementAction::Right | MovementAction::Down => {
|
||||
self.next_option();
|
||||
true
|
||||
}
|
||||
MovementAction::Previous | MovementAction::Left | MovementAction::Up => {
|
||||
self.previous_option();
|
||||
true
|
||||
}
|
||||
MovementAction::Select => {
|
||||
// Actual selection handled in event loop (UiContext::Intro)
|
||||
true
|
||||
}
|
||||
MovementAction::Esc => {
|
||||
// Nothing special for Intro, but could be used to quit
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user