format difficulty buttons
This commit is contained in:
parent
d90e270cd5
commit
d758d03f2d
17
src/game.rs
17
src/game.rs
@ -377,30 +377,35 @@ impl Game {
|
||||
|
||||
let easy_btn = Button::new(
|
||||
"Easy",
|
||||
Rect::new((board_x - btn_w) / 2., (board_y + btn_h) / 2., btn_w, btn_h),
|
||||
ButtonColor::Grey,
|
||||
Rect::new(
|
||||
(board_x - btn_w) / 2.,
|
||||
board_y + (self.square_width - btn_h) / 2.,
|
||||
btn_w,
|
||||
btn_h,
|
||||
),
|
||||
ButtonColor::Blue,
|
||||
);
|
||||
|
||||
let medium_btn = Button::new(
|
||||
"Medium",
|
||||
Rect::new(
|
||||
(board_x - btn_w) / 2.,
|
||||
(board_y + board_width) / 2.,
|
||||
board_y + self.square_width + (self.square_width - btn_h) / 2.,
|
||||
btn_w,
|
||||
btn_h,
|
||||
),
|
||||
ButtonColor::Grey,
|
||||
ButtonColor::Blue,
|
||||
);
|
||||
|
||||
let hard_button = Button::new(
|
||||
"Hard",
|
||||
Rect::new(
|
||||
(board_x - btn_w) / 2.,
|
||||
(board_y + board_width),
|
||||
board_y + 2. * self.square_width + (self.square_width - btn_h) / 2.,
|
||||
btn_w,
|
||||
btn_h,
|
||||
),
|
||||
ButtonColor::Grey,
|
||||
ButtonColor::Blue,
|
||||
);
|
||||
|
||||
self.mode_btns = HashMap::new();
|
||||
|
@ -14,6 +14,7 @@ pub enum ButtonColor {
|
||||
Grey,
|
||||
Green,
|
||||
Red,
|
||||
Blue,
|
||||
}
|
||||
|
||||
impl ButtonColor {
|
||||
@ -22,6 +23,7 @@ impl ButtonColor {
|
||||
ButtonColor::Grey => Color::from_rgba(140, 140, 140, 200),
|
||||
ButtonColor::Green => Color::from_rgba(112, 140, 141, 200),
|
||||
ButtonColor::Red => Color::from_rgba(123, 70, 85, 200),
|
||||
ButtonColor::Blue => Color::from_rgba(140, 120, 250, 200),
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user