fix titlecard/loading screen bugs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#f21d48eab624cac0d113cd653540a0b85403d072" into hollywoo/0.0.0/github/f21d48eab624cac0d113cd653540a0b85403d072
|
||||
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/f21d48eab624cac0d113cd653540a0b85403d072"
|
||||
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#a555cbeb92a032dd31fd66c4717d71a71991d9fb" into hollywoo/0.0.0/github/a555cbeb92a032dd31fd66c4717d71a71991d9fb
|
||||
# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/a555cbeb92a032dd31fd66c4717d71a71991d9fb"
|
||||
-lib kiss
|
||||
-lib kiss-tools
|
||||
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/f21d48eab624cac0d113cd653540a0b85403d072/src/
|
||||
-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/a555cbeb92a032dd31fd66c4717d71a71991d9fb/src/
|
||||
-D hollywoo=0.0.0
|
@@ -576,20 +576,28 @@
|
||||
(var SUBTITLES_MARGIN 30)
|
||||
(var SUBTITLES_SIZE 48)
|
||||
(prop &mut :FlxSprite titleCard null)
|
||||
(method :Void showTitleCard [:Array<String> text :Continuation cc]
|
||||
(prop &mut :FlxSprite loadingCard null)
|
||||
(method :Void showTitleCard [:Array<String> text :Continuation cc &opt :Bool loading]
|
||||
(if loading
|
||||
{
|
||||
(set loadingCard (new FlxSprite))
|
||||
// (dictSet kiss_flixel.SpriteTools.ignoreObjects loadingCard true)
|
||||
(set loadingCard.cameras [flxMovie.uiCamera])
|
||||
}
|
||||
{
|
||||
(set titleCard (new FlxSprite))
|
||||
(when flxMovie.isLoading
|
||||
(dictSet kiss_flixel.SpriteTools.ignoreObjects titleCard true))
|
||||
(unless flxMovie.isLoading
|
||||
(set titleCard.cameras [flxMovie.screenCamera]))
|
||||
(titleCard.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
||||
(SpriteTools.writeOnSprite (text.shift) TITLE_SIZE titleCard (object x (Percent 0.5) y (Pixels TITLE_Y)))
|
||||
(set titleCard.cameras [flxMovie.screenCamera])
|
||||
})
|
||||
(let [card (if loading loadingCard titleCard)]
|
||||
(card.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true)
|
||||
(SpriteTools.writeOnSprite (text.shift) TITLE_SIZE card (object x (Percent 0.5) y (Pixels TITLE_Y)))
|
||||
(localVar &mut subtitleY (+ TITLE_Y TITLE_SIZE TITLE_MARGIN))
|
||||
(doFor subtitle text
|
||||
(SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE titleCard (object x (Percent 0.5) y (Pixels subtitleY)))
|
||||
(SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE card (object x (Percent 0.5) y (Pixels subtitleY)))
|
||||
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN))
|
||||
(FlxG.state.add titleCard)
|
||||
(cc))
|
||||
(FlxG.state.add card)
|
||||
(SpriteTools.logSprites)
|
||||
(cc)))
|
||||
|
||||
(prop &mut :Bool isLoading false)
|
||||
(var LOAD_CALLS_PER_FRAME 2)
|
||||
@@ -652,15 +660,20 @@
|
||||
(bar.createColoredEmptyBar FlxColor.BLACK true FlxColor.WHITE)
|
||||
(bar.createColoredFilledBar FlxColor.WHITE false)
|
||||
(bar.screenCenter)
|
||||
(set bar.camera flxMovie.uiCamera)
|
||||
(FlxG.state.add bar)
|
||||
(FlxG.state.add loop)
|
||||
(dictSet kiss_flixel.SpriteTools.ignoreObjects bar true)
|
||||
(dictSet kiss_flixel.SpriteTools.ignoreObjects loop true))
|
||||
|
||||
(method :Void hideTitleCard []
|
||||
(when titleCard
|
||||
(method :Void hideTitleCard [&opt :Bool loading]
|
||||
(if loading {
|
||||
(FlxG.state.remove loadingCard true)
|
||||
(set loadingCard null)
|
||||
} {
|
||||
(FlxG.state.remove titleCard true)
|
||||
(set titleCard null)))
|
||||
(set titleCard null)
|
||||
}))
|
||||
|
||||
// TODO these could be customizable to the Actor, wrylies, etc.
|
||||
(var DIALOG_BOX_COLOR FlxColor.BLACK)
|
||||
|
@@ -449,15 +449,15 @@
|
||||
(unless notSpecial (dictSet presetPositions (pos.stringify) true))))
|
||||
|
||||
(method &override :Void createCameras []
|
||||
(unless screenCamera
|
||||
(set screenCamera (new flixel.FlxCamera))
|
||||
(set screenCamera.bgColor FlxColor.TRANSPARENT)
|
||||
(FlxG.cameras.add screenCamera))
|
||||
(unless uiCamera
|
||||
(set uiCamera (new flixel.FlxCamera))
|
||||
(set uiCamera.bgColor FlxColor.TRANSPARENT)
|
||||
(flixel.FlxG.cameras.add uiCamera)
|
||||
(set kiss_flixel.SimpleWindow.defaultCamera uiCamera))
|
||||
(unless screenCamera
|
||||
(set screenCamera (new flixel.FlxCamera))
|
||||
(set screenCamera.bgColor FlxColor.TRANSPARENT)
|
||||
(FlxG.cameras.add screenCamera)))
|
||||
(set kiss_flixel.SimpleWindow.defaultCamera uiCamera)))
|
||||
|
||||
(preload
|
||||
// I think it's safe to leave a cleaned-up movie as this reference,
|
||||
|
Reference in New Issue
Block a user