mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
https://loglog.games/blog/leaving-rust-gamedev/#orphan-rule-should-be-optional is on point
46 lines
1.8 KiB
Rust
46 lines
1.8 KiB
Rust
use crate::*;
|
|
|
|
impl Handle<Tui> for Sequencer<Tui> {
|
|
fn handle (&mut self, from: &Tui) -> Perhaps<bool> {
|
|
match from.event() {
|
|
// NONE, "seq_cursor_up", "move cursor up", |sequencer: &mut Sequencer| {
|
|
key!(KeyCode::Up) => {
|
|
match self.entered {
|
|
true => { self.note_axis.point_dec(); },
|
|
false => { self.note_axis.start_dec(); },
|
|
}
|
|
Ok(Some(true))
|
|
},
|
|
// NONE, "seq_cursor_down", "move cursor down", |self: &mut Sequencer| {
|
|
key!(KeyCode::Down) => {
|
|
match self.entered {
|
|
true => { self.note_axis.point_inc(); },
|
|
false => { self.note_axis.start_inc(); },
|
|
}
|
|
Ok(Some(true))
|
|
},
|
|
// NONE, "seq_cursor_left", "move cursor up", |self: &mut Sequencer| {
|
|
key!(KeyCode::Left) => {
|
|
match self.entered {
|
|
true => { self.time_axis.point_dec(); },
|
|
false => { self.time_axis.start_dec(); },
|
|
}
|
|
Ok(Some(true))
|
|
},
|
|
// NONE, "seq_cursor_right", "move cursor up", |self: &mut Sequencer| {
|
|
key!(KeyCode::Right) => {
|
|
match self.entered {
|
|
true => { self.time_axis.point_inc(); },
|
|
false => { self.time_axis.start_inc(); },
|
|
}
|
|
Ok(Some(true))
|
|
},
|
|
// NONE, "seq_mode_switch", "switch the display mode", |self: &mut Sequencer| {
|
|
key!(KeyCode::Char('`')) => {
|
|
self.mode = !self.mode;
|
|
Ok(Some(true))
|
|
},
|
|
_ => Ok(None)
|
|
}
|
|
}
|
|
}
|