mirror of
https://github.com/lucaspalomodevelop/binbreak.git
synced 2026-03-13 00:07:28 +00:00
add vim keybindings
This commit is contained in:
parent
ebc1ce1225
commit
c43e37553e
@ -33,9 +33,9 @@ There is one file for linux and one for windows (.exe).
|
||||
- run the game: `./binbreak-linux`
|
||||
|
||||
## Controls
|
||||
- use the arrow keys for navigation
|
||||
- use the arrow or vim keys for navigation
|
||||
- press Enter to confirm choices
|
||||
- press Esc to exit a game mode or the game. CTRL+C also works to exit the game.
|
||||
- press Esc or Q to exit a game mode or the game. CTRL+C also works to exit the game.
|
||||
|
||||
## Recommended terminals
|
||||
The game should run fine in any terminal. If you want retro CRT effects, here are some recommendations:
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
|
||||
pub(crate) fn is_up(key: KeyEvent) -> bool {
|
||||
matches!(key.code, KeyCode::Up)
|
||||
matches!(key.code, KeyCode::Up | KeyCode::Char('k'))
|
||||
}
|
||||
|
||||
pub(crate) fn is_down(key: KeyEvent) -> bool {
|
||||
matches!(key.code, KeyCode::Down)
|
||||
matches!(key.code, KeyCode::Down | KeyCode::Char('j'))
|
||||
}
|
||||
|
||||
pub(crate) fn is_left(key: KeyEvent) -> bool {
|
||||
matches!(key.code, KeyCode::Left)
|
||||
matches!(key.code, KeyCode::Left | KeyCode::Char('h'))
|
||||
}
|
||||
|
||||
pub(crate) fn is_right(key: KeyEvent) -> bool {
|
||||
matches!(key.code, KeyCode::Right)
|
||||
matches!(key.code, KeyCode::Right | KeyCode::Char('l'))
|
||||
}
|
||||
|
||||
pub(crate) fn is_select(key: KeyEvent) -> bool {
|
||||
@ -21,5 +21,5 @@ pub(crate) fn is_select(key: KeyEvent) -> bool {
|
||||
}
|
||||
|
||||
pub(crate) fn is_exit(key: KeyEvent) -> bool {
|
||||
matches!(key.code, KeyCode::Esc)
|
||||
matches!(key.code, KeyCode::Esc | KeyCode::Char('q' | 'Q'))
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user