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": { "dependencies": {
"kiss": "", "kiss": "",
"kiss-flixel": "", "kiss-flixel": "",
"flixel-addons": "",
"hollywoo": "" "hollywoo": ""
}, },
"url": "https://github.com/NQNStudios/kisslang", "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))) (SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE titleCard (object x (Percent 0.5) y (Pixels subtitleY)))
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN)) (+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN))
(FlxG.state.add titleCard) (FlxG.state.add titleCard)
// Allow skipping (cc))
(startWaitForInput 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 [] (method :Void hideTitleCard []
(FlxG.state.remove titleCard)) (FlxG.state.remove titleCard))
// TODO these could be customizable to the Actor, wrylies, etc. // TODO these could be customizable to the Actor, wrylies, etc.
(var DIALOG_BOX_COLOR FlxColor.BLACK) (var DIALOG_BOX_COLOR FlxColor.BLACK)
(var DIALOG_COLOR FlxColor.WHITE) (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 rollCredits(credits:Array<CreditsLine>, cc:Continuation):Void;
function doLoading(_load:Void->Void, cc:Continuation):Void;
function cleanup():Void; function cleanup():Void;
} }

View File

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

View File

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