Hollywoo loading screen/allow threaded loading

This commit is contained in:
2023-03-09 07:48:33 -07:00
parent e6a4f3ad38
commit dd73c40d35
5 changed files with 22 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
"dependencies": {
"kiss": "",
"kiss-flixel": "",
"flixel-addons": "",
"hollywoo": ""
},
"url": "https://github.com/NQNStudios/kisslang",

View File

@@ -102,13 +102,16 @@
(SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE titleCard (object x (Percent 0.5) y (Pixels subtitleY)))
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN))
(FlxG.state.add titleCard)
// Allow skipping
(startWaitForInput cc))
(cc))
(method :Void doLoading [:Void->Void _load :Continuation cc]
(let [loop (new flixel.addons.util.FlxAsyncLoop 1 ->:Void {(_load)(cc)})]
(haxe.Timer.delay ->:Void (loop.start) 1)
(FlxG.state.add loop)))
(method :Void hideTitleCard []
(FlxG.state.remove titleCard))
// TODO these could be customizable to the Actor, wrylies, etc.
(var DIALOG_BOX_COLOR FlxColor.BLACK)
(var DIALOG_COLOR FlxColor.WHITE)

View File

@@ -56,5 +56,6 @@ interface Director<Set:Cloneable<Set>, ScreenPosition, Actor, Sound, Song, Prop,
function rollCredits(credits:Array<CreditsLine>, cc:Continuation):Void;
function doLoading(_load:Void->Void, cc:Continuation):Void;
function cleanup():Void;
}

View File

@@ -38,10 +38,15 @@
(defMacro end []
`{
(method doPreload [:Void->Void cc]
(set isLoading true)
(collectedBlocks preload)
(set isLoading false)
(cc))
(director.showTitleCard ["LOADING"]
(makeCC
(set isLoading true)
(director.doLoading ->:Void {
(collectedBlocks preload)
(set isLoading false)
} (makeCC
(director.hideTitleCard)
(cc))))))
(method doCleanup []
(director.cleanup)
(set lastInstructionPointer -2)

View File

@@ -374,8 +374,11 @@
(hollywooMethod timedTitleCard true [time :Array<String> lines :Continuation cc]
(let [cc ->{(director.hideTitleCard)(cc)}]
(director.showTitleCard lines cc)
(delay time cc)))
(director.showTitleCard lines
(makeCC
// Allow skipping
(director.startWaitForInput cc)
(delay time cc)))))
// TODO themed titleCard (wait for song or sound)