Skip to content

Commit

Permalink
Changed background color in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Perrelli9338 committed Oct 6, 2024
1 parent 7090d32 commit 66a43db
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
25 changes: 4 additions & 21 deletions src/resources/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Font>,
}
#[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")]
Expand All @@ -35,23 +27,14 @@ pub struct TextureAssets {
#[asset(path = "textures/wrong.png")]
pub wrong: Handle<Image>,
}

#[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<Font>,
}

#[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")]
Expand Down
6 changes: 1 addition & 5 deletions src/scenes/main_menu_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down
19 changes: 9 additions & 10 deletions src/scenes/settings_menu_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.),
Expand Down Expand Up @@ -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.));

});
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 66a43db

Please sign in to comment.