Joystick sprite done
parent
16ac1444ce
commit
d1d0eac44d
Binary file not shown.
After Width: | Height: | Size: 146 B |
Binary file not shown.
After Width: | Height: | Size: 136 B |
|
@ -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
|
27
src/main.rs
27
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<AssetServer>) {
|
|||
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<AssetServer>) {
|
|||
|
||||
let settings_data =
|
||||
serde_yaml::from_str::<Settings>(&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<AssetServer>) {
|
|||
)),
|
||||
..default()
|
||||
},
|
||||
texture: asset_server.load(settings_data.input_sprite_path),
|
||||
texture: asset_server.load(settings_data.input_upper_sprite_path),
|
||||
..default()
|
||||
},
|
||||
InputVisual {
|
||||
|
|
Loading…
Reference in New Issue