Optimizations + FlxLayers

This commit is contained in:
Ne_Eo
2024-08-25 14:54:24 +02:00
parent 997336a503
commit e5d25ccf26
3 changed files with 13 additions and 7 deletions
+4
View File
@@ -1,6 +1,7 @@
package funkin.editors.charter;
// ! FUCK YOU CHUF (your biggest fan -lunar) <3
import flixel.FlxLayer;
import funkin.editors.extra.CameraHoverDummy;
import flixel.input.keyboard.FlxKey;
import flixel.math.FlxPoint;
@@ -88,6 +89,8 @@ class Charter extends UIState {
public static var clipboard:Array<CharterCopyboardObject> = [];
public static var waveformHandler:CharterWaveformHandler;
public var textLayer:FlxLayer;
public function new(song:String, diff:String, reload:Bool = true) {
super();
if (song != null) {
@@ -468,6 +471,7 @@ class Charter extends UIState {
// adds grid and notes so that they're ALWAYS behind the UI
add(gridBackdrops);
add(textLayer = new FlxLayer());
add(eventsBackdrop);
add(addEventSpr);
add(eventsGroup);
@@ -133,7 +133,7 @@ class CharterBackdrop extends FlxTypedGroup<Dynamic> {
waveformSprite = new FlxSprite().makeSolid(1, 1, 0xFF000000);
waveformSprite.scale.set(160, 1);
waveformSprite.updateHitbox();
waveformSprite.updateHitbox();
add(waveformSprite);
sectionSeparator = new FlxBackdrop(null, Y, 0, 0);
+8 -6
View File
@@ -67,6 +67,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
if(noteTypeTexts[v] == null || noteTypeTexts[v].graphic.isDestroyed) {
noteTypeTexts[v] = new UIText(x, y, 0, Std.string(v));
noteTypeTexts[v].exists = v != 0;
noteTypeTexts[v].layer = (Charter.instance != null) ? Charter.instance.textLayer : null;
}
typeText = noteTypeTexts[v];
@@ -92,8 +93,7 @@ class CharterNote extends UISprite implements ICharterSelectable {
this.type = type;
if (strumLine != null) this.strumLine = strumLine;
//
//typeText.text = Std.string(this.type);
sustainSpr.exists = susLength != 0;
y = step * 40;
@@ -144,10 +144,12 @@ class CharterNote extends UISprite implements ICharterSelectable {
public override function update(elapsed:Float) {
super.update(elapsed);
var sprLength:Float = (40 * (susLength+tempSusLength)) + ((susLength+tempSusLength) != 0 ? (height/2) : 0);
sustainSpr.scale.set(10, __susInstaLerp ? sprLength : CoolUtil.fpsLerp(sustainSpr.scale.y, sprLength, 1/2));
sustainSpr.updateHitbox();
sustainSpr.follow(this, 15, 20);
if(susLength != 0) {
var sprLength:Float = (40 * (susLength+tempSusLength)) + ((susLength+tempSusLength) != 0 ? (height/2) : 0);
sustainSpr.scale.set(10, __susInstaLerp ? sprLength : CoolUtil.fpsLerp(sustainSpr.scale.y, sprLength, 1/2));
sustainSpr.updateHitbox();
sustainSpr.follow(this, 15, 20);
}
sustainDraggable = false;
if (!hovered && susLength != 0) {