fix: keep font loaded

This commit is contained in:
Pascal Engélibert 2022-08-23 12:42:56 +02:00
commit d9232fd5f0
Signed by: tuxmain
GPG key ID: 3504BC6D362F7DCA
7 changed files with 25 additions and 25 deletions

View file

@ -223,7 +223,6 @@ fn collision_event_system(
if app_state.current() == &AppState::Game
&& 4. - new_color.length_squared() < 0.1
{
println!("win");
app_state.replace(AppState::Win).ok();
}
@ -326,22 +325,22 @@ fn keyboard_input_system(
}
}
// TODO: the text is not visible, I don't know why.
fn win_setup(mut commands: Commands, asset_server: Res<AssetServer>) {
println!("win system");
let font = asset_server.get_handle("Cantarell-VF.otf");
commands.spawn_bundle(Text2dBundle {
text: Text::from_section(
"Press ENTER to level up",
TextStyle {
font,
font_size: 32.0,
color: Color::WHITE,
},
)
.with_alignment(TextAlignment::CENTER),
..Default::default()
});
let font = asset_server.get_handle("UacariLegacy-Thin.ttf");
commands
.spawn_bundle(Text2dBundle {
text: Text::from_section(
"Press ENTER to level up",
TextStyle {
font,
font_size: 32.0,
color: Color::WHITE,
},
)
.with_alignment(TextAlignment::CENTER),
..Default::default()
})
.insert(Level);
}
// Sounds