Replace spawn_ui implementation
This commit is contained in:
34
src/lib.rs
34
src/lib.rs
@@ -229,36 +229,10 @@ fn wrap_entities(mut query: Query<&mut Position>, world_size: Res<WorldSize>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) {
|
fn spawn_ui(mut commands: Commands, score: Res<Score>, lives: Res<Lives>) {
|
||||||
commands.spawn(TextBundle::from_sections([
|
commands.spawn((
|
||||||
TextSection::new(
|
Text::new(format!("Score: {score:?} | Lives: {lives:?}")),
|
||||||
"Score: ",
|
TextFont::from_font_size(25.0),
|
||||||
TextStyle {
|
));
|
||||||
font_size: 25.0,
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextSection::new(
|
|
||||||
*score,
|
|
||||||
TextStyle {
|
|
||||||
font_size: 25.0,
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextSection::new(
|
|
||||||
" | Lives: ",
|
|
||||||
TextStyle {
|
|
||||||
font_size: 25.0,
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextSection::new(
|
|
||||||
*lives,
|
|
||||||
TextStyle {
|
|
||||||
font_size: 25.0,
|
|
||||||
..default()
|
|
||||||
},
|
|
||||||
),
|
|
||||||
]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_screen(mut commands: Commands) {
|
fn start_screen(mut commands: Commands) {
|
||||||
|
|||||||
Reference in New Issue
Block a user