diff --git a/assets/circle_empty.png b/assets/circle_empty.png new file mode 100644 index 0000000..a2bf2c3 Binary files /dev/null and b/assets/circle_empty.png differ diff --git a/assets/circle_full.png b/assets/circle_full.png new file mode 100644 index 0000000..f7832b4 Binary files /dev/null and b/assets/circle_full.png differ diff --git a/data/settings/settings.yml b/data/settings/default.yml similarity index 72% rename from data/settings/settings.yml rename to data/settings/default.yml index 48949c8..1c2e14b 100644 --- a/data/settings/settings.yml +++ b/data/settings/default.yml @@ -4,7 +4,8 @@ down: S left: A right: D - input_sprite_path: neocat.png + input_lower_sprite_path: circle_empty.png + input_upper_sprite_path: circle_full.png input_sprite_size: [ 30.0, 30.0 diff --git a/src/main.rs b/src/main.rs index 6653196..e049502 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,8 @@ pub struct Settings { pub down: String, pub left: String, pub right: String, - pub input_sprite_path: String, + pub input_lower_sprite_path: String, + pub input_upper_sprite_path: String, pub input_sprite_size: Vec2, pub input_sprite_location: Vec2, } @@ -60,7 +61,8 @@ fn setup(mut commands: Commands, asset_server: Res) { down: S left: A right: D - input_sprite_path: neocat.png + input_lower_sprite_path: circle_empty.png + input_upper_sprite_path: circle_full.png input_sprite_size: [ 30.0, 30.0 @@ -76,7 +78,26 @@ fn setup(mut commands: Commands, asset_server: Res) { let settings_data = serde_yaml::from_str::(&settings_yaml[0]).expect("Error serializing to YAML"); - + commands.spawn( + SpriteBundle { + sprite: Sprite { + custom_size: Some(Vec2::new( + settings_data.input_sprite_size.x, + settings_data.input_sprite_size.y, + )), + anchor: + bevy::sprite::Anchor::Custom(Vec2::new( + 6.658, + 6.658, + )), + + ..default() + }, + texture: asset_server.load(settings_data.input_lower_sprite_path), + ..default() + + } + ); commands.spawn(( SpriteBundle { sprite: Sprite { @@ -86,7 +107,7 @@ fn setup(mut commands: Commands, asset_server: Res) { )), ..default() }, - texture: asset_server.load(settings_data.input_sprite_path), + texture: asset_server.load(settings_data.input_upper_sprite_path), ..default() }, InputVisual {