blob: d8c8e921c975ee12c9563f0e84dbf9d6c22a1098 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
pub fn spawn_task(
event_w: async_std::channel::Sender<crate::event::Event>,
mut input: textmode::Input,
) {
async_std::task::spawn(async move {
while let Some(key) = input.read_key().await.unwrap() {
let event = match key {
textmode::Key::Char('g' | '0' | ')') => {
crate::event::Event::TimerAction(
crate::event::TimerAction::FirstFrame,
)
}
textmode::Key::Char('G' | '$') => {
crate::event::Event::TimerAction(
crate::event::TimerAction::LastFrame,
)
}
textmode::Key::Char('l' | 'n') => {
crate::event::Event::TimerAction(
crate::event::TimerAction::NextFrame,
)
}
textmode::Key::Char('h' | 'p') => {
crate::event::Event::TimerAction(
crate::event::TimerAction::PreviousFrame,
)
}
textmode::Key::Char('q') => crate::event::Event::Quit,
textmode::Key::Char(' ') => crate::event::Event::TimerAction(
crate::event::TimerAction::Pause,
),
textmode::Key::Ctrl(b'i') => crate::event::Event::ToggleUi,
_ => continue,
};
event_w.send(event).await.unwrap();
}
});
}
|