From 0e5dd9968b7fdfb0db852cff400b1eb70fcd3df1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Montegaspp=CE=B1=20Cacilh=CE=B1=CF=82?= Date: Tue, 11 Apr 2023 11:04:02 -0300 Subject: [PATCH 1/2] use bg colour instead of fg --- src/block.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/block.rs b/src/block.rs index 4c46125..5c120aa 100644 --- a/src/block.rs +++ b/src/block.rs @@ -16,12 +16,17 @@ impl Block { impl fmt::Display for Block { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let bg = if self.chr == 'X' { Color::white() } else { self.color }; + let fg = if self.chr == 'X' { Color::black() } else { Color::white() }; + write!( f, - "{}{}{}", - color::Fg(self.color), + "{}{}{}{}{}", + color::Fg(fg), + color::Bg(bg), self.chr, - color::Fg(color::Reset) + color::Fg(color::Reset), + color::Bg(Color::black()), ) } } From 214d7bc844e2cb811a5e627959f2931a52dbd372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Montegaspp=CE=B1=20Cacilh=CE=B1=CF=82?= Date: Tue, 11 Apr 2023 11:10:32 -0300 Subject: [PATCH 2/2] up also rotates --- src/game.rs | 1 + src/inputs/keys.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/game.rs b/src/game.rs index cc343f4..163dc0a 100644 --- a/src/game.rs +++ b/src/game.rs @@ -46,6 +46,7 @@ fn make_help_modal(inputs: &Inputs) -> Modal { fn key_name(key: Key) -> String { match key { Key::Char(chr) => chr.to_string(), + Key::Up => "↑".to_string(), Key::Left => "←".to_string(), Key::Right => "→".to_string(), Key::Down => "↓".to_string(), diff --git a/src/inputs/keys.rs b/src/inputs/keys.rs index c035880..e0036ac 100644 --- a/src/inputs/keys.rs +++ b/src/inputs/keys.rs @@ -22,6 +22,7 @@ impl KeyConverter { use super::Order::*; match self { KeyConverter::Normal => hash_map! { + Key::Up => Rotate(RotateDir::Clockwise), Key::Left => Move(Dir::Left), Key::Right => Move(Dir::Right), Key::Down => Move(Dir::Down),