Skip to content

Commit 845b604

Browse files
committed
Merge branch 'KohoolateSen-pause'
2 parents f2ecb78 + 19b7403 commit 845b604

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/main.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,19 @@ fn welcome_screen(mut sc: &Stdout, world: &World) {
405405
let _ = sc.queue(Clear(crossterm::terminal::ClearType::All));
406406
}
407407

408+
fn pause_screen(mut sc: &Stdout , world: &World) {
409+
let pause_msg1: &str = "╔═══════════╗";
410+
let pause_msg2: &str = "║Game Paused║";
411+
let pause_msg3: &str = "╚═══════════╝";
412+
let _ = sc.queue(MoveTo(world.maxc / 2 - 6, world.maxl / 2 - 1));
413+
let _ = sc.queue(Print(pause_msg1));
414+
let _ = sc.queue(MoveTo(world.maxc / 2 - 6, world.maxl / 2));
415+
let _ = sc.queue(Print(pause_msg2));
416+
let _ = sc.queue(MoveTo(world.maxc / 2 - 6, world.maxl / 2 + 1));
417+
let _ = sc.queue(Print(pause_msg3));
418+
let _ = sc.flush();
419+
}
420+
408421
fn goodbye_screen(mut sc: &Stdout, world: &World) {
409422
let goodbye_msg1: &str = " ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ █████╗ ███╗ ███╗███████╗██╗\n\r██╔════╝ ██╔═══██╗██╔═══██╗██╔══██╗ ██╔════╝ ██╔══██╗████╗ ████║██╔════╝██║\n\r██║ ███╗██║ ██║██║ ██║██║ ██║ ██║ ███╗███████║██╔████╔██║█████╗ ██║\n\r██║ ██║██║ ██║██║ ██║██║ ██║ ██║ ██║██╔══██║██║╚██╔╝██║██╔══╝ ╚═╝\n\r╚██████╔╝╚██████╔╝╚██████╔╝██████╔╝ ╚██████╔╝██║ ██║██║ ╚═╝ ██║███████╗██╗\n\r ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝\n";
410423
let goodbye_msg2: &str = "████████╗██╗ ██╗ █████╗ ███╗ ██╗██╗ ██╗███████╗\n\r╚══██╔══╝██║ ██║██╔══██╗████╗ ██║██║ ██╔╝██╔════╝\n\r ██║ ███████║███████║██╔██╗ ██║█████╔╝ ███████╗\n\r ██║ ██╔══██║██╔══██║██║╚██╗██║██╔═██╗ ╚════██║\n\r ██║ ██║ ██║██║ ██║██║ ╚████║██║ ██╗███████║██╗\n\r ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝╚═╝\n";
@@ -586,6 +599,8 @@ fn main() -> std::io::Result<()> {
586599
if world.status != PlayerStatus::Paused {
587600
physics(&mut world);
588601
draw(&sc, &mut world)?;
602+
} else {
603+
pause_screen(&sc, &world);
589604
}
590605
thread::sleep(time::Duration::from_millis(slowness));
591606
}
@@ -597,4 +612,4 @@ fn main() -> std::io::Result<()> {
597612
.execute(Show)?;
598613
disable_raw_mode()?;
599614
Ok(())
600-
}
615+
}

0 commit comments

Comments
 (0)