From 48876b6faa390875add95e9d0885d536b83bfa11 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 22 Jul 2024 21:53:58 +0200 Subject: [PATCH] actually fixing tint --- examples/tint.rs | 8 ++++---- src/utils.rs | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/examples/tint.rs b/examples/tint.rs index 231c4cf..5d702bc 100644 --- a/examples/tint.rs +++ b/examples/tint.rs @@ -45,10 +45,10 @@ impl VirtualJoystickAction for TintAction { is_base_or_knob = world.get::(entity).is_some() || world.get::(entity).is_some(); } - let Some(mut bg_color) = world.get_mut::(child) else { + let Some(mut ui_image) = world.get_mut::(child) else { continue; }; - bg_color.0 = self.down; + ui_image.color = self.down; } } @@ -74,10 +74,10 @@ impl VirtualJoystickAction for TintAction { is_base_or_knob = world.get::(entity).is_some() || world.get::(entity).is_some(); } - let Some(mut bg_color) = world.get_mut::(child) else { + let Some(mut ui_image) = world.get_mut::(child) else { continue; }; - bg_color.0 = self.up; + ui_image.color = self.up; } } } diff --git a/src/utils.rs b/src/utils.rs index 1ec9bc8..71276df 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -144,7 +144,9 @@ pub fn create_joystick( VirtualJoystickUIBackground, ImageBundle { image: UiImage { - color: knob_color.unwrap_or(Color::WHITE.with_alpha(1.0)).into(), + color: background_color + .unwrap_or(Color::WHITE.with_alpha(1.0)) + .into(), texture: background_img, ..default() }, @@ -154,9 +156,6 @@ pub fn create_joystick( height: Val::Px(background_size.y), ..default() }, - background_color: background_color - .unwrap_or(Color::WHITE.with_alpha(0.0)) - .into(), z_index: ZIndex::Local(0), ..default() },