add "Previous message" command

ctrl+p, like nethack. Cycles through messages, also like nethack.

May want to add some sort of indicator of how many messages there have
been.
This commit is contained in:
Griffin Smith 2019-07-07 13:02:50 -04:00
parent c643ee1dfc
commit 20f1ccb460
3 changed files with 31 additions and 5 deletions

View file

@ -1,11 +1,17 @@
use super::Direction;
use super::Direction::*;
use termion::event::Key;
use termion::event::Key::Char;
use termion::event::Key::{Char, Ctrl};
pub enum Command {
/// Quit the game
Quit,
/// Move the character in a direction
Move(Direction),
/// Display the previous message
PreviousMessage,
}
impl Command {
@ -17,6 +23,7 @@ impl Command {
Char('k') | Char('w') | Key::Up => Some(Move(Up)),
Char('j') | Char('s') | Key::Down => Some(Move(Down)),
Char('l') | Char('d') | Key::Right => Some(Move(Right)),
Ctrl('p') => Some(PreviousMessage),
_ => None,
}
}