allow making demo flxDirector for options menu

This commit is contained in:
2023-08-26 18:58:25 -06:00
parent 26218572fd
commit efb179b3d6

View File

@@ -37,29 +37,31 @@
(set pauseMenu.onClose ->:Void (FlxG.switchState (new MenuState)))} (set pauseMenu.onClose ->:Void (FlxG.switchState (new MenuState)))}
(movie.run))) (movie.run)))
(defNew [] // MenuState uses a director instance to demo the volume. This shouldn't affect flixel globals i.e. by adding an actionManager or sprite layers
// Continue action requires fresh input, Fast Forward action supports continuous holding down (defNew [&opt :Bool demoDirector]
(set continueAction (new FlxActionDigital "Continue" onContinue)) (unless demoDirector
(set fastForwardAction (new FlxActionDigital "Fast Forward")) // Continue action requires fresh input, Fast Forward action supports continuous holding down
// TODO allow configuring continue/fast-forward keys -- any key, specifically mapped keys, etc. (set continueAction (new FlxActionDigital "Continue" onContinue))
(doFor [:FlxActionDigital action :FlxInputState trigger] (zipThrow [continueAction fastForwardAction] [JUST_PRESSED PRESSED]) (set fastForwardAction (new FlxActionDigital "Fast Forward"))
(action.addKey SPACE trigger) // TODO allow configuring continue/fast-forward keys -- any key, specifically mapped keys, etc.
(action.addKey ENTER trigger) (doFor [:FlxActionDigital action :FlxInputState trigger] (zipThrow [continueAction fastForwardAction] [JUST_PRESSED PRESSED])
(action.addKey SPACE trigger)
(action.addKey ENTER trigger)
(action.addMouse LEFT trigger)
(action.addGamepad FlxGamepadInputID.A trigger FlxInputDeviceID.ALL)
(actionManager.addAction action))
(FlxG.inputs.add actionManager)
(#when debug (kiss_flixel.DebugTools.f1ToRecord actionManager))
(set actionManager.resetOnStateSwitch NONE)
(action.addMouse LEFT trigger) (doFor i (range (+ 1 LAYER_MAX))
(let [g (new FlxTypedGroup<FlxSprite>)]
(action.addGamepad FlxGamepadInputID.A trigger FlxInputDeviceID.ALL) (spriteLayers.push g)
(FlxG.state.add g)))))
(actionManager.addAction action))
(FlxG.inputs.add actionManager)
(#when debug (kiss_flixel.DebugTools.f1ToRecord actionManager))
(set actionManager.resetOnStateSwitch NONE)
(doFor i (range (+ 1 LAYER_MAX))
(let [g (new FlxTypedGroup<FlxSprite>)]
(spriteLayers.push g)
(FlxG.state.add g))))
(prop :Map<SceneTime,FlxSprite> skySprites (new Map)) (prop :Map<SceneTime,FlxSprite> skySprites (new Map))
(prop &mut :FlxSprite skySprite) (prop &mut :FlxSprite skySprite)