version can be displayed as message
This commit is contained in:
parent
b6d61e4bd1
commit
f6bb0a9297
@ -131,6 +131,9 @@ fn main() -> Result<()> {
|
||||
})?;
|
||||
if event::poll(std::time::Duration::from_millis(FRAME_LENGTH))? {
|
||||
if let event::Event::Key(key) = event::read()? {
|
||||
if key.kind == KeyEventKind::Press && key.code == KeyCode::Char('v') {
|
||||
game.messages.insert(0, format!("You are playing version '{}'.", env!("GIT_HASH")).to_string());
|
||||
}
|
||||
if key.kind == KeyEventKind::Press && key.code == KeyCode::Char('q') {
|
||||
break;
|
||||
}
|
||||
@ -187,7 +190,6 @@ fn main() -> Result<()> {
|
||||
text += format!("\nYou gained {} experience.", game.get_player().get_experience()).as_str();
|
||||
text += format!("\nYou collected {} gold.", game.get_player().get_gold()).as_str();
|
||||
text += format!("\nYou played {} seconds.", playtime.as_secs()).as_str();
|
||||
text += format!("\nYou played game version '{}'.", env!("GIT_HASH")).as_str();
|
||||
let paragraph = Paragraph::new(text).block(block).wrap(Wrap { trim: true });
|
||||
frame.render_widget(paragraph, area);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user