From 01250852c557dda7f83273fc413fc8d252bd11d8 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 17 Feb 2024 04:45:12 -0500 Subject: [PATCH] simplified preloader --- source/funkin/Preloader.hx | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/source/funkin/Preloader.hx b/source/funkin/Preloader.hx index 24015be05..2a73d8199 100644 --- a/source/funkin/Preloader.hx +++ b/source/funkin/Preloader.hx @@ -8,6 +8,9 @@ import flash.display.Sprite; import flixel.system.FlxBasePreloader; import openfl.display.Sprite; import funkin.util.CLIUtil; +import openfl.text.TextField; +import openfl.text.TextFormat; +import flixel.system.FlxAssets; @:bitmap("art/preloaderArt.png") class LogoImage extends BitmapData {} @@ -21,12 +24,26 @@ class Preloader extends FlxBasePreloader } var logo:Sprite; + var _text:TextField; override function create():Void { this._width = Lib.current.stage.stageWidth; this._height = Lib.current.stage.stageHeight; + _text = new TextField(); + _text.width = 500; + _text.text = "Loading FNF"; + _text.defaultTextFormat = new TextFormat(FlxAssets.FONT_DEFAULT, 16, 0xFFFFFFFF); + _text.embedFonts = true; + _text.selectable = false; + _text.multiline = false; + _text.wordWrap = false; + _text.autoSize = LEFT; + _text.x = 2; + _text.y = 2; + addChild(_text); + var ratio:Float = this._width / 2560; // This allows us to scale assets depending on the size of the screen. logo = new Sprite(); @@ -34,27 +51,14 @@ class Preloader extends FlxBasePreloader logo.scaleX = logo.scaleY = ratio; logo.x = ((this._width) / 2) - ((logo.width) / 2); logo.y = (this._height / 2) - ((logo.height) / 2); - addChild(logo); // Adds the graphic to the NMEPreloader's buffer. + // addChild(logo); // Adds the graphic to the NMEPreloader's buffer. super.create(); } override function update(Percent:Float):Void { - if (Percent < 69) - { - logo.scaleX += Percent / 1920; - logo.scaleY += Percent / 1920; - logo.x -= Percent * 0.6; - logo.y -= Percent / 2; - } - else - { - logo.scaleX = this._width / 1280; - logo.scaleY = this._width / 1280; - logo.x = ((this._width) / 2) - ((logo.width) / 2); - logo.y = (this._height / 2) - ((logo.height) / 2); - } + _text.text = "FNF: " + Math.round(Percent * 100) + "%"; super.update(Percent); }