fake loading bars

This commit is contained in:
2024-02-11 22:55:39 -07:00
parent fd0e7b687a
commit ca5b0c2f7b
3 changed files with 56 additions and 5 deletions

View File

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

View File

@@ -521,6 +521,57 @@
(cc) (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] (method overlayPropOnCurrentSet [propKey :Void->Void cc]
(let [propKey (kiss.FuzzyMapTools.bestMatch props propKey)] (let [propKey (kiss.FuzzyMapTools.bestMatch props propKey)]
(dictSet shownProps propKey true) // Don't scale when showing (dictSet shownProps propKey true) // Don't scale when showing

View File

@@ -90,9 +90,9 @@ CLEARCHARACTERS
"ScreenCenterLeft" "ScreenCenterLeft"
"ScreenCenterRight" "ScreenCenterRight"
"ScreenUpperLeft" "ScreenUpperLeft"
"ScreenUpperRight" "ScreenUpperRight"
"ScreenLowerLeft" "ScreenLowerLeft"
"ScreenLowerRight" "ScreenLowerRight"
"ScreenLowerCenter" "ScreenLowerCenter"
"ScreenUpperCenter" "ScreenUpperCenter"
]) ])