mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2025-03-21 20:39:52 -04:00
simplified preloader
This commit is contained in:
parent
2baac0e983
commit
01250852c5
1 changed files with 19 additions and 15 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue