Skip to content

Commit

Permalink
actually fixing tint
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickChodowski committed Jul 22, 2024
1 parent ac85c47 commit 48876b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 4 additions & 4 deletions examples/tint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ impl VirtualJoystickAction<String> for TintAction {
is_base_or_knob = world.get::<VirtualJoystickUIBackground>(entity).is_some()
|| world.get::<VirtualJoystickUIKnob>(entity).is_some();
}
let Some(mut bg_color) = world.get_mut::<BackgroundColor>(child) else {
let Some(mut ui_image) = world.get_mut::<UiImage>(child) else {
continue;
};
bg_color.0 = self.down;
ui_image.color = self.down;
}
}

Expand All @@ -74,10 +74,10 @@ impl VirtualJoystickAction<String> for TintAction {
is_base_or_knob = world.get::<VirtualJoystickUIBackground>(entity).is_some()
|| world.get::<VirtualJoystickUIKnob>(entity).is_some();
}
let Some(mut bg_color) = world.get_mut::<BackgroundColor>(child) else {
let Some(mut ui_image) = world.get_mut::<UiImage>(child) else {
continue;
};
bg_color.0 = self.up;
ui_image.color = self.up;
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ pub fn create_joystick<I: VirtualJoystickID>(
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()
},
Expand All @@ -154,9 +156,6 @@ pub fn create_joystick<I: VirtualJoystickID>(
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()
},
Expand Down

0 comments on commit 48876b6

Please sign in to comment.