Skip to content

Commit

Permalink
fix(repo): added assets
Browse files Browse the repository at this point in the history
  • Loading branch information
JeromeSchmied committed Feb 25, 2024
1 parent bdbd6d9 commit a7e1c72
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
Binary file added assets/0.1.0_gosper_glider_gun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
60 changes: 60 additions & 0 deletions src/kmaps.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};

/// Create Event from ch
fn ch_to_event(ch: char) -> Event {
Event::Key(KeyCode::Char(ch).into())
}

pub fn play_pause() -> Vec<Event> {
vec![ch_to_event(' ')]
}

pub fn slower() -> Vec<Event> {
vec![ch_to_event('j'), Event::Key(KeyCode::Down.into())]
}
pub fn slower_big() -> Vec<Event> {
vec![
ch_to_event('J'),
Event::Key(KeyEvent::new(KeyCode::Down, KeyModifiers::SHIFT)),
]
}

pub fn faster() -> Vec<Event> {
vec![ch_to_event('k'), Event::Key(KeyCode::Up.into())]
}
pub fn faster_big() -> Vec<Event> {
vec![
ch_to_event('K'),
Event::Key(KeyEvent::new(KeyCode::Up, KeyModifiers::SHIFT)),
]
}

pub fn quit() -> Vec<Event> {
vec![
Event::Key(KeyCode::Esc.into()),
ch_to_event('q'),
Event::Key(KeyEvent::new(KeyCode::Char('c'), KeyModifiers::CONTROL)),
]
}

pub fn restart() -> Vec<Event> {
vec![ch_to_event('r')]
}

pub fn reset() -> Vec<Event> {
vec![ch_to_event('R')]
}

pub fn next() -> Vec<Event> {
vec![ch_to_event('n')]
}
pub fn prev() -> Vec<Event> {
vec![ch_to_event('p')]
}

pub fn bigger() -> Vec<Event> {
vec![ch_to_event('+')]
}
pub fn smaller() -> Vec<Event> {
vec![ch_to_event('-')]
}

0 comments on commit a7e1c72

Please sign in to comment.