fix selectagon flickering on hud toggle

This commit is contained in:
yuni 2024-04-24 03:55:27 +02:00
parent fe89308a94
commit 366500e928

View file

@ -195,6 +195,7 @@ fn setup(
settings: Res<var::Settings>,
asset_server: Res<AssetServer>,
mut ambient_light: ResMut<AmbientLight>,
mut ew_updateoverlays: EventWriter<UpdateOverlayVisibility>,
) {
let visibility = if settings.hud_active {
Visibility::Inherited
@ -375,6 +376,8 @@ fn setup(
} else {
AMBIENT_LIGHT
};
ew_updateoverlays.send(UpdateOverlayVisibility);
}
fn update_hud(
@ -661,7 +664,6 @@ fn handle_input(
}
}
if keyboard_input.just_pressed(settings.key_togglehud) {
ew_updateoverlays.send(UpdateOverlayVisibility);
settings.hud_active ^= true;
if settings.hud_active {
ambient_light.brightness = AMBIENT_LIGHT_AR;
@ -670,6 +672,7 @@ fn handle_input(
}
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Switch));
ew_togglemusic.send(audio::ToggleMusicEvent());
ew_updateoverlays.send(UpdateOverlayVisibility);
}
if settings.hud_active && mouse_input.just_pressed(settings.key_selectobject) {
if let Ok(camtrans) = q_camera.get_single() {