Hollywoo loading screen/allow threaded loading
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
"dependencies": {
|
||||
"kiss": "",
|
||||
"kiss-flixel": "",
|
||||
"flixel-addons": "",
|
||||
"hollywoo": ""
|
||||
},
|
||||
"url": "https://github.com/NQNStudios/kisslang",
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user