format difficulty buttons

This commit is contained in:
cool-mist 2025-05-18 00:22:21 +05:30
parent d90e270cd5
commit d758d03f2d
2 changed files with 13 additions and 6 deletions

View File

@ -377,30 +377,35 @@ impl Game {
let easy_btn = Button::new( let easy_btn = Button::new(
"Easy", "Easy",
Rect::new((board_x - btn_w) / 2., (board_y + btn_h) / 2., btn_w, btn_h), Rect::new(
ButtonColor::Grey, (board_x - btn_w) / 2.,
board_y + (self.square_width - btn_h) / 2.,
btn_w,
btn_h,
),
ButtonColor::Blue,
); );
let medium_btn = Button::new( let medium_btn = Button::new(
"Medium", "Medium",
Rect::new( Rect::new(
(board_x - btn_w) / 2., (board_x - btn_w) / 2.,
(board_y + board_width) / 2., board_y + self.square_width + (self.square_width - btn_h) / 2.,
btn_w, btn_w,
btn_h, btn_h,
), ),
ButtonColor::Grey, ButtonColor::Blue,
); );
let hard_button = Button::new( let hard_button = Button::new(
"Hard", "Hard",
Rect::new( Rect::new(
(board_x - btn_w) / 2., (board_x - btn_w) / 2.,
(board_y + board_width), board_y + 2. * self.square_width + (self.square_width - btn_h) / 2.,
btn_w, btn_w,
btn_h, btn_h,
), ),
ButtonColor::Grey, ButtonColor::Blue,
); );
self.mode_btns = HashMap::new(); self.mode_btns = HashMap::new();

View File

@ -14,6 +14,7 @@ pub enum ButtonColor {
Grey, Grey,
Green, Green,
Red, Red,
Blue,
} }
impl ButtonColor { impl ButtonColor {
@ -22,6 +23,7 @@ impl ButtonColor {
ButtonColor::Grey => Color::from_rgba(140, 140, 140, 200), ButtonColor::Grey => Color::from_rgba(140, 140, 140, 200),
ButtonColor::Green => Color::from_rgba(112, 140, 141, 200), ButtonColor::Green => Color::from_rgba(112, 140, 141, 200),
ButtonColor::Red => Color::from_rgba(123, 70, 85, 200), ButtonColor::Red => Color::from_rgba(123, 70, 85, 200),
ButtonColor::Blue => Color::from_rgba(140, 120, 250, 200),
} }
} }