From 32a73e7d7035dbf30864519b0de513f4e2560452 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 26 Mar 2021 21:33:16 -0400 Subject: [PATCH] checkbox fix in progress --- source/ui/PreferencesMenu.hx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/ui/PreferencesMenu.hx b/source/ui/PreferencesMenu.hx index fd72eed47..2fa44f478 100644 --- a/source/ui/PreferencesMenu.hx +++ b/source/ui/PreferencesMenu.hx @@ -13,7 +13,7 @@ class PreferencesMenu extends ui.OptionsState.Page var items:TextMenuList; - var checkboxes:Array = []; + var checkboxes:Array = []; public function new() { @@ -69,7 +69,8 @@ class PreferencesMenu extends ui.OptionsState.Page function createCheckbox(prefString:String) { - var checkbox:CheckboxThingie = new CheckboxThingie(0, 100 * items.length, preferences.get(prefString)); + var checkbox:CheckboxThingie = new CheckboxThingie(0, 100 * (items.length - 1), preferences.get(prefString)); + checkboxes.push(checkbox); add(checkbox); } @@ -81,6 +82,7 @@ class PreferencesMenu extends ui.OptionsState.Page var daSwap:Bool = preferences.get(prefName); daSwap = !daSwap; preferences.set(prefName, daSwap); + checkboxes[items.selectedIndex].daValue = daSwap; trace('toggled? ' + preferences.get(prefName)); } @@ -115,6 +117,11 @@ class CheckboxThingie extends FlxSprite makeGraphic(50, 50, FlxColor.WHITE); } + override function update(elapsed:Float) + { + super.update(elapsed); + } + function set_daValue(value:Bool):Bool { if (value)