fix titlecard/loading screen bugs

This commit is contained in:
2024-08-15 17:51:07 -05:00
parent fe16caf092
commit 2716449a59
3 changed files with 38 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#f21d48eab624cac0d113cd653540a0b85403d072" into 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/f21d48eab624cac0d113cd653540a0b85403d072" # @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/a555cbeb92a032dd31fd66c4717d71a71991d9fb"
-lib kiss -lib kiss
-lib kiss-tools -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 -D hollywoo=0.0.0

View File

@@ -576,20 +576,28 @@
(var SUBTITLES_MARGIN 30) (var SUBTITLES_MARGIN 30)
(var SUBTITLES_SIZE 48) (var SUBTITLES_SIZE 48)
(prop &mut :FlxSprite titleCard null) (prop &mut :FlxSprite titleCard null)
(method :Void showTitleCard [:Array<String> text :Continuation cc] (prop &mut :FlxSprite loadingCard null)
(set titleCard (new FlxSprite)) (method :Void showTitleCard [:Array<String> text :Continuation cc &opt :Bool loading]
(when flxMovie.isLoading (if loading
(dictSet kiss_flixel.SpriteTools.ignoreObjects titleCard true)) {
(unless flxMovie.isLoading (set loadingCard (new FlxSprite))
(set titleCard.cameras [flxMovie.screenCamera])) // (dictSet kiss_flixel.SpriteTools.ignoreObjects loadingCard true)
(titleCard.makeGraphic FlxG.width FlxG.height FlxColor.BLACK true) (set loadingCard.cameras [flxMovie.uiCamera])
(SpriteTools.writeOnSprite (text.shift) TITLE_SIZE titleCard (object x (Percent 0.5) y (Pixels TITLE_Y))) }
(localVar &mut subtitleY (+ TITLE_Y TITLE_SIZE TITLE_MARGIN)) {
(doFor subtitle text (set titleCard (new FlxSprite))
(SpriteTools.writeOnSprite subtitle SUBTITLES_SIZE titleCard (object x (Percent 0.5) y (Pixels subtitleY))) (set titleCard.cameras [flxMovie.screenCamera])
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN)) })
(FlxG.state.add titleCard) (let [card (if loading loadingCard titleCard)]
(cc)) (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 card (object x (Percent 0.5) y (Pixels subtitleY)))
(+= subtitleY SUBTITLES_SIZE SUBTITLES_MARGIN))
(FlxG.state.add card)
(SpriteTools.logSprites)
(cc)))
(prop &mut :Bool isLoading false) (prop &mut :Bool isLoading false)
(var LOAD_CALLS_PER_FRAME 2) (var LOAD_CALLS_PER_FRAME 2)
@@ -652,15 +660,20 @@
(bar.createColoredEmptyBar FlxColor.BLACK true FlxColor.WHITE) (bar.createColoredEmptyBar FlxColor.BLACK true FlxColor.WHITE)
(bar.createColoredFilledBar FlxColor.WHITE false) (bar.createColoredFilledBar FlxColor.WHITE false)
(bar.screenCenter) (bar.screenCenter)
(set bar.camera flxMovie.uiCamera)
(FlxG.state.add bar) (FlxG.state.add bar)
(FlxG.state.add loop) (FlxG.state.add loop)
(dictSet kiss_flixel.SpriteTools.ignoreObjects bar true) (dictSet kiss_flixel.SpriteTools.ignoreObjects bar true)
(dictSet kiss_flixel.SpriteTools.ignoreObjects loop true)) (dictSet kiss_flixel.SpriteTools.ignoreObjects loop true))
(method :Void hideTitleCard [] (method :Void hideTitleCard [&opt :Bool loading]
(when titleCard (if loading {
(FlxG.state.remove loadingCard true)
(set loadingCard null)
} {
(FlxG.state.remove titleCard true) (FlxG.state.remove titleCard true)
(set titleCard null))) (set titleCard null)
}))
// 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)

View File

@@ -449,15 +449,15 @@
(unless notSpecial (dictSet presetPositions (pos.stringify) true)))) (unless notSpecial (dictSet presetPositions (pos.stringify) true))))
(method &override :Void createCameras [] (method &override :Void createCameras []
(unless screenCamera
(set screenCamera (new flixel.FlxCamera))
(set screenCamera.bgColor FlxColor.TRANSPARENT)
(FlxG.cameras.add screenCamera))
(unless uiCamera (unless uiCamera
(set uiCamera (new flixel.FlxCamera)) (set uiCamera (new flixel.FlxCamera))
(set uiCamera.bgColor FlxColor.TRANSPARENT) (set uiCamera.bgColor FlxColor.TRANSPARENT)
(flixel.FlxG.cameras.add uiCamera) (flixel.FlxG.cameras.add uiCamera)
(set kiss_flixel.SimpleWindow.defaultCamera uiCamera)) (set kiss_flixel.SimpleWindow.defaultCamera uiCamera)))
(unless screenCamera
(set screenCamera (new flixel.FlxCamera))
(set screenCamera.bgColor FlxColor.TRANSPARENT)
(FlxG.cameras.add screenCamera)))
(preload (preload
// I think it's safe to leave a cleaned-up movie as this reference, // I think it's safe to leave a cleaned-up movie as this reference,