From ca5b0c2f7bc51e991c0fec393614ee1fccacaf6b Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Sun, 11 Feb 2024 22:55:39 -0700 Subject: [PATCH] fake loading bars --- haxe_libraries/hollywoo.hxml | 6 +-- src/hollywoo_flixel/HollywooFlixelDSL.kiss | 51 ++++++++++++++++++++++ src/test/source/Test.hollywoo | 4 +- 3 files changed, 56 insertions(+), 5 deletions(-) diff --git a/haxe_libraries/hollywoo.hxml b/haxe_libraries/hollywoo.hxml index da21fe6..8a8b7c5 100644 --- a/haxe_libraries/hollywoo.hxml +++ b/haxe_libraries/hollywoo.hxml @@ -1,6 +1,6 @@ -# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#727aab12f6624307683dc490e17d567b8d0f6de7" into hollywoo/0.0.0/github/727aab12f6624307683dc490e17d567b8d0f6de7 -# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/727aab12f6624307683dc490e17d567b8d0f6de7" +# @install: lix --silent download "gh://github.com/kiss-lang/hollywoo#b64546ed50c8bd4465a7a32151dd11670feb3ba2" into hollywoo/0.0.0/github/b64546ed50c8bd4465a7a32151dd11670feb3ba2 +# @run: haxelib run-dir hollywoo "${HAXE_LIBCACHE}/hollywoo/0.0.0/github/b64546ed50c8bd4465a7a32151dd11670feb3ba2" -lib kiss -lib kiss-tools --cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/727aab12f6624307683dc490e17d567b8d0f6de7/src/ +-cp ${HAXE_LIBCACHE}/hollywoo/0.0.0/github/b64546ed50c8bd4465a7a32151dd11670feb3ba2/src/ -D hollywoo=0.0.0 \ No newline at end of file diff --git a/src/hollywoo_flixel/HollywooFlixelDSL.kiss b/src/hollywoo_flixel/HollywooFlixelDSL.kiss index 5d814ea..2946fd4 100644 --- a/src/hollywoo_flixel/HollywooFlixelDSL.kiss +++ b/src/hollywoo_flixel/HollywooFlixelDSL.kiss @@ -521,6 +521,57 @@ (cc) })))))) +(prop &mut :flixel.ui.FlxBar bar null) +(prop &mut :Int barProgress 0) +(prop &mut :Int barMax 0) +(prop &mut :Bool skippedBar false) +(method fakeLoadingBar [:Bool skipping :Dynamic position :Dynamic delayV :Int steps :Int width :Int height :FlxColor full :FlxColor empty :Void->Void cc] + (when skipping + (cc) + (return)) + + (set skippedBar false) + (set barProgress 0) + (set barMax steps) + (set bar (new flixel.ui.FlxBar 0 0 LEFT_TO_RIGHT width height this "barProgress" 0 barMax true)) + (bar.createColoredEmptyBar empty true full) + (bar.createColoredFilledBar full false) + (localVar position (resolvePosition position null)) + (set bar.x position.x) + (set bar.y position.y) + (FlxG.state.add bar) + (localVar inputDelayKey (inputKey)) + (localVar delayAmount (/ (resolveDelay delayV) steps)) + (withFunctions + [ + (:Void wrappedCC [] + (stopWaitForInput inputDelayKey) + (set skippedBar true) + + (FlxG.state.remove bar true) + (cc)) + (:Void checkDelay [] + (when skippedBar (return)) + + (if (= barMax barProgress) + (wrappedCC) + (delay skipping delayAmount + (makeCC + (trace "cc") + (+= barProgress 1) + (checkDelay)) + + true))) + ] + (startWaitForInput wrappedCC inputDelayKey) + (checkDelay))) + +(cleanup + (when bar + (FlxG.state.remove bar true) + (bar.destroy) + (set bar null))) + (method overlayPropOnCurrentSet [propKey :Void->Void cc] (let [propKey (kiss.FuzzyMapTools.bestMatch props propKey)] (dictSet shownProps propKey true) // Don't scale when showing diff --git a/src/test/source/Test.hollywoo b/src/test/source/Test.hollywoo index 13ea50a..0c6dec7 100644 --- a/src/test/source/Test.hollywoo +++ b/src/test/source/Test.hollywoo @@ -90,9 +90,9 @@ CLEARCHARACTERS "ScreenCenterLeft" "ScreenCenterRight" "ScreenUpperLeft" - "ScreenUpperRight" + "ScreenUpperRight" "ScreenLowerLeft" - "ScreenLowerRight" + "ScreenLowerRight" "ScreenLowerCenter" "ScreenUpperCenter" ])