feat: add amazing textures

This commit is contained in:
2026-08-19 19:25:31 +02:00
parent 2d89cf7725
commit 3720a0640a
4 changed files with 79 additions and 12 deletions

View File

@@ -1,8 +1,12 @@
use checkers::ui::{macroquad::main_menu::draw_main_menu, state::GuiState};
use macroquad::{
color::{BLUE, RED},
color::{BLACK, BLUE, RED, WHITE},
math::vec2,
miniquad::{self, conf::LinuxBackend::WaylandWithX11Fallback},
window::{Conf, clear_background, next_frame},
prelude::ImageFormat,
texture::{DrawTextureParams, Image, Texture2D, draw_texture, draw_texture_ex, load_texture},
ui::{Skin, root_ui},
window::{Conf, clear_background, next_frame, screen_height, screen_width},
};
fn window_conf() -> Conf {
@@ -23,9 +27,41 @@ pub async fn main() {
let mut state = Default::default();
let background = load_texture("assets/background.png").await.unwrap();
let style = root_ui()
.style_builder()
.text_color(WHITE)
.font_size(64)
.build();
let button_style = root_ui()
.style_builder()
.text_color(BLACK)
.font_size(32)
.build();
let skin = Skin {
label_style: style,
button_style: button_style,
..root_ui().default_skin()
};
root_ui().push_skin(&skin);
loop {
match state {
GuiState::MainMenu => {
draw_texture_ex(
&background,
0.0,
0.0,
WHITE,
DrawTextureParams {
dest_size: Some(vec2(screen_width(), screen_height())),
..DrawTextureParams::default()
},
);
draw_main_menu(&mut state).await;
}