rsnaker/graphics/menus/
status.rs

1use crate::graphics::menus::layout_utils::render_full_centered_paragraph;
2use ratatui::style::Color;
3use ratatui::Frame;
4
5// For ASCII art use AI or a generator as:
6// http://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Pause
7// For text display: https://ratatui.rs/recipes/render/display-text/
8const GAME_OVER_TEXT: &str = "\n\
9 ██████╗  █████╗ ███╗   ███╗███████╗       ██████╗ ██╗   ██╗███████╗██████╗ \n\
10██╔═══   ██╔══██╗████╗ ████║██╔════╝      ██╔═══██╗██║   ██║██╔════╝██╔══██╗\n\
11██║ ████║███████║██╔████╔██║█████╗        ██║   ██║██║   ██║█████╗  ██████╔╝\n\
12██║   ██║██╔══██║██║╚██╔╝██║██╔══╝        ██║   ██║██║   ██║██╔══╝  ██╔══██╗\n\
13╚██████╔╝██║  ██║██║ ╚═╝ ██║███████╗      ╚██████╔╝╚██████╔╝███████╗██║  ██║\n\
14 ╚═════╝ ╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝       ╚═════╝  ╚═════╝ ╚══════╝╚═╝  ╚═╝\n\
15                       Press R to restart the game ! \n\
16                       Press M to go back to menu ! \n\
17                       Press Q to quit ! ";
18
19const PAUSE_TEXT: &str = "\n\
20██████╗  █████╗ ██╗   ██╗███████╗███████╗\n\
21██╔══██╗██╔══██╗██║   ██║██╔════╝██╔════╝\n\
22██████╔╝███████║██║   ██║███████╗█████╗  \n\
23██╔═══╝ ██╔══██║██║   ██║╚════██║██╔══╝  \n\
24██║     ██║  ██║╚██████╔╝███████║███████╗\n\
25╚═╝     ╚═╝  ╚═╝ ╚═════╝ ╚══════╝╚══════╝";
26//goodbye
27const MENU_TEXT: &str = "\n\
28███╗   ███╗███████╗███╗   ██╗██╗   ██╗
29████╗ ████║██╔════╝████╗  ██║██║   ██║
30██╔████╔██║█████╗  ██╔██╗ ██║██║   ██║
31██║╚██╔╝██║██╔══╝  ██║╚██╗██║██║   ██║
32██║ ╚═╝ ██║███████╗██║ ╚████║╚██████╔╝
33╚═╝     ╚═╝╚══════╝╚═╝  ╚═══╝ ╚═════╝ ";
34
35const FAREWELL_TEXT: &str = "\n\
36██████╗ ██╗   ██╗███████╗    ██████╗ ██╗   ██╗███████╗
37██╔══██╗╚██╗ ██╔╝██╔════╝    ██╔══██╗╚██╗ ██╔╝██╔════╝
38██████╔╝ ╚████╔╝ █████╗█████╗██████╔╝ ╚████╔╝ █████╗  
39██╔══██╗  ╚██╔╝  ██╔══╝╚════╝██╔══██╗  ╚██╔╝  ██╔══╝  
40██████╔╝   ██║   ███████╗    ██████╔╝   ██║   ███████╗
41╚═════╝    ╚═╝   ╚══════╝    ╚═════╝    ╚═╝   ╚══════╝";
42
43const RESTART_TEXT: &str = "\n\
44██████╗ ███████╗███████╗████████╗ █████╗ ██████╗ ████████╗
45██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔══██╗██╔══██╗╚══██╔══╝
46██████╔╝█████╗  ███████╗   ██║   ███████║██████╔╝   ██║   
47██╔══██╗██╔══╝  ╚════██║   ██║   ██╔══██║██╔══██╗   ██║   
48██║  ██║███████╗███████║   ██║   ██║  ██║██║  ██║   ██║   
49╚═╝  ╚═╝╚══════╝╚══════╝   ╚═╝   ╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝   ";
50
51pub fn game_over_paragraph(frame: &mut Frame) {
52    render_full_centered_paragraph(frame, GAME_OVER_TEXT, Some(Color::Red));
53}
54pub fn pause_paragraph(frame: &mut Frame) {
55    render_full_centered_paragraph(frame, PAUSE_TEXT, None);
56}
57pub fn byebye_paragraph(frame: &mut Frame) {
58    render_full_centered_paragraph(frame, FAREWELL_TEXT, Some(Color::DarkGray));
59}
60pub fn restart_paragraph(frame: &mut Frame) {
61    render_full_centered_paragraph(frame, RESTART_TEXT, Some(Color::LightYellow));
62}
63pub fn menu_paragraph(frame: &mut Frame) {
64    //Rgb Purple badly managed by old terminals Color::Rgb(128, 0, 128)
65    render_full_centered_paragraph(frame, MENU_TEXT, Some(Color::Gray));
66}