mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-28 11:10:44 +01:00
feat: first draft at window
This commit is contained in:
@@ -1 +1,39 @@
|
||||
fn draw_main_menu() {}
|
||||
use log::info;
|
||||
use macroquad::{
|
||||
color::{BLACK, WHITE},
|
||||
input::is_mouse_button_pressed,
|
||||
math::vec2,
|
||||
ui::{StyleBuilder, hash, root_ui},
|
||||
window::{clear_background, next_frame, screen_height, screen_width},
|
||||
};
|
||||
|
||||
use crate::ui::state::GuiState;
|
||||
|
||||
pub async fn draw_main_menu(state: &mut GuiState) {
|
||||
let style = root_ui().style_builder().text_color(WHITE).font_size(64);
|
||||
let text_style = root_ui().style_builder().text_color(WHITE).font_size(32);
|
||||
|
||||
let window_size = vec2(370.0, 320.0);
|
||||
|
||||
root_ui().window(
|
||||
hash!(),
|
||||
vec2(screen_width() / 2.0, screen_height() / 2.0),
|
||||
window_size,
|
||||
|ui| {
|
||||
ui.label(vec2(80.0, -34.0), "Main Menu");
|
||||
if ui.button(vec2(65.0, 25.0), "Play") {
|
||||
*state = GuiState::Game;
|
||||
}
|
||||
|
||||
if ui.button(vec2(65.0, 25.0), "Settings") {
|
||||
*state = GuiState::Settings;
|
||||
}
|
||||
|
||||
if ui.button(vec2(65.0, 125.0), "Quit") {
|
||||
*state = GuiState::Exit;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
next_frame().await;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#[derive(Default)]
|
||||
pub enum GuiState {
|
||||
#[default]
|
||||
MainMenu,
|
||||
Settings,
|
||||
Game,
|
||||
Exit,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user