From 66a43db0750c4b423c01975661ea119d5c5abc36 Mon Sep 17 00:00:00 2001 From: Perrelli9338 Date: Sun, 6 Oct 2024 11:45:01 +0200 Subject: [PATCH] Changed background color in settings --- Cargo.toml | 2 +- src/resources/assets.rs | 25 ++++--------------------- src/scenes/main_menu_plugin.rs | 6 +----- src/scenes/settings_menu_plugin.rs | 19 +++++++++---------- 4 files changed, 15 insertions(+), 37 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ac0eba3..5406091 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,7 +57,7 @@ bevy = { version = "0.14.2", default-features = false, features = [ # keep the following in sync with Bevy's dependencies bevy_asset_loader = "0.21" bevy_embedded_assets = "0.11.0" -sickle_ui = "0.3.0" +sickle_ui = { rev = "9c6ebb6", git = "https://github.com/UkoeHB/sickle_ui" } web-time = "1.1.0" rand = { version = "0.8.5", default-features = false, features = ["std", "std_rng"] } winit = "0.30.5" diff --git a/src/resources/assets.rs b/src/resources/assets.rs index 3d737e5..56a9133 100644 --- a/src/resources/assets.rs +++ b/src/resources/assets.rs @@ -5,21 +5,13 @@ use bevy::{ use bevy_asset_loader::asset_collection::AssetCollection; #[derive(AssetCollection, Resource)] pub struct AudioAssets {} -#[cfg(not(all( - not(target_os = "android"), - not(target_os = "ios"), - not(target_os = "wasm32") -)))] +#[cfg(all(target_os = "android", target_os = "ios", target_os = "wasm32"))] #[derive(AssetCollection, Resource)] pub struct FontAssets { #[asset(path = "pixeled.ttf")] pub font: Handle, } -#[cfg(not(all( - not(target_os = "android"), - not(target_os = "ios"), - not(target_os = "wasm32") -)))] +#[cfg(all(target_os = "android", target_os = "ios", target_os = "wasm32"))] #[derive(AssetCollection, Resource)] pub struct TextureAssets { #[asset(path = "textures/icon.png")] @@ -35,23 +27,14 @@ pub struct TextureAssets { #[asset(path = "textures/wrong.png")] pub wrong: Handle, } - -#[cfg(all( - not(target_os = "android"), - not(target_os = "ios"), - not(target_os = "wasm32") -))] +#[cfg(not(all(target_os = "android", target_os = "ios", target_os = "wasm32")))] #[derive(AssetCollection, Resource)] pub struct FontAssets { #[asset(path = "embedded://pixeled.ttf")] pub font: Handle, } -#[cfg(all( - not(target_os = "android"), - not(target_os = "ios"), - not(target_os = "wasm32") -))] +#[cfg(not(all(target_os = "android", target_os = "ios", target_os = "wasm32")))] #[derive(AssetCollection, Resource)] pub struct TextureAssets { #[asset(path = "embedded://textures/icon.png")] diff --git a/src/scenes/main_menu_plugin.rs b/src/scenes/main_menu_plugin.rs index b7cfcf6..7bcf915 100644 --- a/src/scenes/main_menu_plugin.rs +++ b/src/scenes/main_menu_plugin.rs @@ -52,11 +52,7 @@ impl MainMenu { .flex_direction(FlexDirection::Row); parent.button_main_menu("Play", MenuButtonAction::Play); parent.button_main_menu("Settings", MenuButtonAction::Settings); - #[cfg(all( - not(target_arch = "wasm32"), - not(target_os = "android"), - not(target_os = "ios") - ))] + #[cfg(not(all(target_os = "android", target_os = "ios", target_os = "wasm32")))] parent.button_main_menu("Quit", MenuButtonAction::Quit); parent.text(&format!("v{}-rc", env!("CARGO_PKG_VERSION")), None); }, diff --git a/src/scenes/settings_menu_plugin.rs b/src/scenes/settings_menu_plugin.rs index 05ba7eb..26fda03 100644 --- a/src/scenes/settings_menu_plugin.rs +++ b/src/scenes/settings_menu_plugin.rs @@ -63,7 +63,7 @@ impl SettingsMenu { display: Display::Flex, flex_direction: FlexDirection::Column, width: Val::Percent(100.0), - height: Val::Percent(100.0), + height: Val::Percent(90.0), margin: UiRect::all(Val::Auto), align_items: AlignItems::Center, row_gap: Val::Px(15.), @@ -105,21 +105,20 @@ impl SettingsMenu { children.settings(SettingsMenuButtonAction::DecrementWidthBoard, SettingsMenuButtonAction::IncrementWidthBoard, "Width", &config.map_size.0.to_string()); children.settings(SettingsMenuButtonAction::DecrementHeightBoard, SettingsMenuButtonAction::IncrementHeightBoard, "Height", &config.map_size.1.to_string()); children.settings(SettingsMenuButtonAction::DecrementBombCount, SettingsMenuButtonAction::IncrementBombCount, "Bombs", &config.bomb_count.to_string()); - }).style().display(Display::Flex).flex_direction(FlexDirection::Column).row_gap(Val::Px(5.)); + }).style_inplace(|style| { + style.display(Display::Flex).flex_direction(FlexDirection::Column).row_gap(Val::Px(5.)).background_color(Color::linear_rgb(0.2, 0.2, 0.2)); + }).style_unchecked(); }); tab_container.add_tab("Game".into(), |panel| { panel.container(NodeBundle::default(), |children| { - - children.settings(SettingsMenuButtonAction::SafeStartOff, SettingsMenuButtonAction::SafeStartOn, "Safe start", & match config.easy_mode { + children.settings(SettingsMenuButtonAction::SafeStartOff, SettingsMenuButtonAction::SafeStartOn, "Safe start", &match config.easy_mode { true => "On", false => "Off", - } - .to_string()); + }.to_string()); children.settings(SettingsMenuButtonAction::TurnFlagOff, SettingsMenuButtonAction::TurnFlagOn, "Flag mode", &match config.flag_mode { true => "On", false => "Off", - } - .to_string()); + }.to_string()); }).style().display(Display::Flex).flex_direction(FlexDirection::Column).row_gap(Val::Px(5.)); }); @@ -232,12 +231,12 @@ impl SettingsMenu { true => "On", false => "Off", } - .to_string(), + .to_string(), match config.easy_mode { true => "On", false => "Off", } - .to_string(), + .to_string(), config.bomb_count.to_string(), config.map_size.1.to_string(), config.map_size.0.to_string(),