From 638c1666633cddd73398efbb2ccc6cb0bf59aa3d Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 15 Feb 2024 04:10:48 -0500 Subject: [PATCH] optimization when opening from pause menu --- source/funkin/ui/debug/latency/LatencyState.hx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/latency/LatencyState.hx b/source/funkin/ui/debug/latency/LatencyState.hx index 0d486fca1..282f05651 100644 --- a/source/funkin/ui/debug/latency/LatencyState.hx +++ b/source/funkin/ui/debug/latency/LatencyState.hx @@ -51,10 +51,21 @@ class LatencyState extends MusicBeatSubState */ var localConductor:Conductor; + // stores values of what the previous persistent draw/update stuff was, example if opened + // from pause menu, we want to NOT draw persistently, but then resume drawing once closed + var prevPersistentDraw:Bool; + var prevPersistentUpdate:Bool; + override function create() { super.create(); + prevPersistentDraw = FlxG.state.persistentDraw; + prevPersistentUpdate = FlxG.state.persistentUpdate; + + FlxG.state.persistentDraw = false; + FlxG.state.persistentUpdate = false; + localConductor = new Conductor(); conductorInUse = localConductor; @@ -179,7 +190,6 @@ class LatencyState extends MusicBeatSubState override public function close():Void { PreciseInputManager.instance.onInputPressed.remove(preciseInputPressed); - PreciseInputManager.instance.onInputReleased.remove(preciseInputReleased); FlxG.sound.music.volume = previousVolume; @@ -188,6 +198,8 @@ class LatencyState extends MusicBeatSubState FlxG.cameras.remove(stateCamera); + FlxG.state.persistentDraw = prevPersistentDraw; + FlxG.state.persistentUpdate = prevPersistentUpdate; super.close(); }