From 366500e92870bef374ada911458d5aa88d1b1af7 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 24 Apr 2024 03:55:27 +0200 Subject: [PATCH] fix selectagon flickering on hud toggle --- src/hud.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hud.rs b/src/hud.rs index 3c420a6..96b4eba 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -195,6 +195,7 @@ fn setup( settings: Res, asset_server: Res, mut ambient_light: ResMut, + mut ew_updateoverlays: EventWriter, ) { 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() {