1
0
Fork 0
roguelike-game/src/gui/game_over_menu.rs

63 lines
1.5 KiB
Rust

use ::rltk::Rltk;
use crate::{colors, gamelog};
#[derive(PartialEq, Copy, Clone)]
pub enum GameOverResult {
NoSelection,
QuitToMenu,
}
pub fn game_over(ctx: &mut Rltk) -> GameOverResult {
ctx.print_color_centered(15, colors::YELLOW, colors::BLACK, "Your journey has ended!");
ctx.print_color_centered(
17,
colors::WHITE,
colors::BLACK,
"One day, we'll tell you all about how you did.",
);
ctx.print_color_centered(
18,
colors::WHITE,
colors::BLACK,
"That day, sadly, is not in this chapter...",
);
ctx.print_color_centered(
19,
colors::WHITE,
colors::BLACK,
format!("You lived for {} turns.", gamelog::get_event_count("Turn")),
);
ctx.print_color_centered(
20,
colors::RED,
colors::BLACK,
&format!(
"You suffered {} points of damage.",
gamelog::get_event_count("Damage Taken")
),
);
ctx.print_color_centered(
21,
colors::RED,
colors::BLACK,
&format!(
"You inflicted {} points of damage.",
gamelog::get_event_count("Damage Inflicted")
),
);
ctx.print_color_centered(
23,
colors::MAGENTA,
colors::BLACK,
"Press any key to return to the menu.",
);
match ctx.key {
None => GameOverResult::NoSelection,
Some(_) => GameOverResult::QuitToMenu,
}
}