From 6205470907b3c74955162e97fe65c29930f86471 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 4 Apr 2021 20:37:23 -0400 Subject: [PATCH] autopause bullshit --- source/ui/PreferencesMenu.hx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/source/ui/PreferencesMenu.hx b/source/ui/PreferencesMenu.hx index beba8cab2..d843b7d88 100644 --- a/source/ui/PreferencesMenu.hx +++ b/source/ui/PreferencesMenu.hx @@ -35,6 +35,7 @@ class PreferencesMenu extends ui.OptionsState.Page createPrefItem('flashing menu', 'flashing-menu', true); createPrefItem('Camera Zooming on Beat', 'camera-zoom', true); createPrefItem('FPS Counter', 'fps-counter', true); + createPrefItem('Auto Pause', 'auto-pause', false); camFollow = new FlxObject(FlxG.width / 2, 0, 140, 70); if (items != null) @@ -63,9 +64,12 @@ class PreferencesMenu extends ui.OptionsState.Page preferenceCheck('flashing-menu', true); preferenceCheck('camera-zoom', true); preferenceCheck('fps-counter', true); + preferenceCheck('auto-pause', false); if (!getPref('fps-counter')) FlxG.stage.removeChild(Main.fpsCounter); + + FlxG.autoPause = getPref('auto-pause'); } private function createPrefItem(prefName:String, prefString:String, prefValue:Dynamic):Void @@ -114,13 +118,18 @@ class PreferencesMenu extends ui.OptionsState.Page checkboxes[items.selectedIndex].daValue = daSwap; trace('toggled? ' + preferences.get(prefName)); - if (prefName == 'fps-counter') + switch (prefName) { - if (getPref('fps-counter')) - FlxG.stage.addChild(Main.fpsCounter); - else - FlxG.stage.removeChild(Main.fpsCounter); + case 'fps-counter': + if (getPref('fps-counter')) + FlxG.stage.addChild(Main.fpsCounter); + else + FlxG.stage.removeChild(Main.fpsCounter); + case 'auto-pause': + FlxG.autoPause = getPref('auto-pause'); } + + if (prefName == 'fps-counter') {} } override function update(elapsed:Float)