From 6abae37a7c721b1923fd9ce7d20b3c90c69d69a5 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 27 Oct 2021 14:15:46 -0400 Subject: [PATCH] Flixel-hollywoo waitForInputOrDelay() --- src/hollywoo_flixel/FlxDirector.hx | 3 +++ src/hollywoo_flixel/FlxDirector.kiss | 34 +++++++++++++++++++++++++--- src/hollywoo_flixel/FlxMovie.hx | 3 +++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/hollywoo_flixel/FlxDirector.hx b/src/hollywoo_flixel/FlxDirector.hx index a36a9a6..5b6dfb3 100644 --- a/src/hollywoo_flixel/FlxDirector.hx +++ b/src/hollywoo_flixel/FlxDirector.hx @@ -4,6 +4,9 @@ import kiss.Prelude; import kiss.List; import flixel.FlxG; import flixel.FlxSprite; +import flixel.input.actions.FlxAction; +import flixel.input.actions.FlxActionManager; +import flixel.input.mouse.FlxMouseButton; import hollywoo.Scene; import hollywoo.Director; import hollywoo_flixel.FlxMovie; diff --git a/src/hollywoo_flixel/FlxDirector.kiss b/src/hollywoo_flixel/FlxDirector.kiss index cd0abf9..b4bed4b 100644 --- a/src/hollywoo_flixel/FlxDirector.kiss +++ b/src/hollywoo_flixel/FlxDirector.kiss @@ -1,7 +1,35 @@ -(defNew []) +(prop :FlxActionDigital continueAction) +(prop actionManager (new FlxActionManager)) + +(defNew [] + (set continueAction (new FlxActionDigital "Continue" onContinue)) + // TODO allow configuring continue keys -- any key, specifically mapped keys, etc. + (continueAction.addKey SPACE JUST_PRESSED) + (continueAction.addMouse LEFT JUST_PRESSED) + (actionManager.addAction continueAction) + (FlxG.inputs.add actionManager) + (set actionManager.resetOnStateSwitch NONE)) (method :Void showScene [:Scene scene :Appearance appearance :Continuation cc] - (FlxG.switchState (cast scene SceneFlxState))) + (FlxG.switchState (cast scene SceneFlxState)) + (cc)) (method :Void showCharacter [:Character character :Appearance appearance :Continuation cc] - (print "Character shneezy")) + (print "Character shneezy") + (cc)) + +(prop &mut :Null nextCC) +(method onContinue [:FlxActionDigital continueAction] + (whenLet [cc nextCC] + (set nextCC null) + (cc))) + +(method :Void waitForInputOrDelay [:Float delaySeconds :Continuation cc] + // TODO allow user to choose between automatic delays and continue checks + (if true + //{ + (set nextCC cc) + // TODO show an indicator that input is needed + //} + ) + ) \ No newline at end of file diff --git a/src/hollywoo_flixel/FlxMovie.hx b/src/hollywoo_flixel/FlxMovie.hx index c3a6bb0..1116490 100644 --- a/src/hollywoo_flixel/FlxMovie.hx +++ b/src/hollywoo_flixel/FlxMovie.hx @@ -25,4 +25,7 @@ enum FlxScreenPosition { UpperCenter; } +/** + * Model/controller of a Hollywoo-Flixel film, and main execution script + */ class FlxMovie extends Movie {}