From c13b4cbb29c2be4bb20000a6836b737319697ad6 Mon Sep 17 00:00:00 2001 From: Patrick Date: Mon, 22 Jul 2024 21:21:04 +0200 Subject: [PATCH] brought parentheses back and fix for white color --- examples/simple.rs | 2 +- examples/simple_mobile/src/lib.rs | 2 +- examples/tint.rs | 2 +- src/utils.rs | 20 ++++++++++---------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/simple.rs b/examples/simple.rs index bd1f8a2..c263516 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -57,7 +57,7 @@ fn create_scene(mut cmd: Commands, asset_server: Res) { bottom: Val::Percent(15.), ..default() }, - JoystickFloating, + (JoystickFloating), NoAction, ); } diff --git a/examples/simple_mobile/src/lib.rs b/examples/simple_mobile/src/lib.rs index 749cfe0..b5159d8 100644 --- a/examples/simple_mobile/src/lib.rs +++ b/examples/simple_mobile/src/lib.rs @@ -64,7 +64,7 @@ fn create_scene(mut cmd: Commands, asset_server: Res) { bottom: Val::Percent(15.), ..default() }, - JoystickFloating, + (JoystickFloating), NoAction, ); } diff --git a/examples/tint.rs b/examples/tint.rs index fbc0935..231c4cf 100644 --- a/examples/tint.rs +++ b/examples/tint.rs @@ -122,7 +122,7 @@ fn create_scene(mut cmd: Commands, asset_server: Res) { bottom: Val::Percent(15.), ..default() }, - JoystickFloating, + (JoystickFloating), TintAction { down: Color::srgba(1.0, 0.0, 0.0, 1.0), // Red up: Color::srgba(0.0, 1.0, 0.0, 0.5), // Green diff --git a/src/utils.rs b/src/utils.rs index e809a2a..5c40e60 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -122,30 +122,30 @@ pub fn create_joystick( ); let spawn = spawn.with_children(|parent| { parent.spawn(( - VirtualJoystickUIKnob, + VirtualJoystickUIBackground, ImageBundle { - image: knob_img.into(), + image: background_img.into(), style: Style { position_type: PositionType::Absolute, - width: Val::Px(knob_size.x), - height: Val::Px(knob_size.y), + width: Val::Px(background_size.x), + height: Val::Px(background_size.y), ..default() }, - background_color: knob_color.unwrap_or(Color::WHITE).into(), + background_color: background_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(), ..default() }, )); parent.spawn(( - VirtualJoystickUIBackground, + VirtualJoystickUIKnob, ImageBundle { - image: background_img.into(), + image: knob_img.into(), style: Style { position_type: PositionType::Absolute, - width: Val::Px(background_size.x), - height: Val::Px(background_size.y), + width: Val::Px(knob_size.x), + height: Val::Px(knob_size.y), ..default() }, - background_color: background_color.unwrap_or(Color::WHITE).into(), + background_color: knob_color.unwrap_or(Color::WHITE.with_alpha(0.0)).into(), ..default() }, ));