From e7557c67f25d2f6a85a82094bd3e4c57e76124f0 Mon Sep 17 00:00:00 2001 From: Elijah Voigt Date: Mon, 7 Jul 2025 09:51:05 -0700 Subject: [PATCH] revert small windows cross compilation changes --- .cargo/config.toml | 1 - src/bin/trees/main.rs | 65 ++++++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index b6be663..b310a20 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -30,7 +30,6 @@ rustflags = [ "link-arg=-fuse-ld=mold" ] - # for Windows [target.x86_64-pc-windows-msvc] linker = "rust-lld.exe" diff --git a/src/bin/trees/main.rs b/src/bin/trees/main.rs index 34d7465..73a2a64 100644 --- a/src/bin/trees/main.rs +++ b/src/bin/trees/main.rs @@ -105,23 +105,44 @@ struct DialogBox; /// Initialize the UI which consists soley of a dialog box (for now?) fn init_ui(mut commands: Commands) { - commands.spawn(( - DialogBox, - BackgroundColor(BLACK.with_alpha(0.9).into()), - Node { - align_self: AlignSelf::End, - justify_self: JustifySelf::Center, - width: Val::Percent(98.0), - max_height: Val::Percent(25.0), - align_items: AlignItems::Center, - margin: UiRect::all(Val::Percent(1.0)), - padding: UiRect::all(Val::Percent(1.0)), - flex_direction: FlexDirection::Column, - // Scroll on the Y axis - overflow: Overflow::scroll_y(), - ..default() - }, - )); + commands + .spawn(( + DialogBox, + BackgroundColor(BLACK.with_alpha(0.9).into()), + Node { + align_self: AlignSelf::End, + justify_self: JustifySelf::Center, + width: Val::Percent(98.0), + max_height: Val::Percent(25.0), + align_items: AlignItems::Center, + margin: UiRect::all(Val::Percent(1.0)), + padding: UiRect::all(Val::Percent(1.0)), + flex_direction: FlexDirection::Column, + // Scroll on the Y axis + overflow: Overflow::scroll_y(), + ..default() + }, + )) + .observe(hover_dialog_box_over) + .observe(hover_dialog_box_out); +} + +fn hover_dialog_box_over( + trigger: Trigger>, + mut query: Query<&mut BackgroundColor, With>, +) { + if let Ok(mut bg) = query.get_mut(trigger.target()) { + bg.0.set_alpha(0.95); + } +} + +fn hover_dialog_box_out( + trigger: Trigger>, + mut query: Query<&mut BackgroundColor, With>, +) { + if let Ok(mut bg) = query.get_mut(trigger.target()) { + bg.0.set_alpha(0.9); + } } /// On startup move the camera to a suitable position @@ -226,17 +247,15 @@ fn choose_dialog_option( fn hover_dialog_option_over( trigger: Trigger>, - mut query: Query<&mut TextColor>, + mut query: Query<(&mut TextColor, &mut BackgroundColor)>, ) { - if let Ok(mut tc) = query.get_mut(trigger.target()) { + if let Ok((mut tc, mut bg)) = query.get_mut(trigger.target()) { *tc = TextColor(DARK_ORANGE.into()); + bg.set_alpha(1.0); } } -fn hover_dialog_option_out( - trigger: Trigger>, - mut query: Query<&mut TextColor>, -) { +fn hover_dialog_option_out(trigger: Trigger>, mut query: Query<&mut TextColor>) { if let Ok(mut tc) = query.get_mut(trigger.target()) { *tc = TextColor(ORANGE.into()); }