From c5dd3ad2a365aa3856a9630659d326425f7fbfb4 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Thu, 5 Sep 2024 23:06:49 +0200 Subject: [PATCH] Small Optimizations --- source/funkin/editors/charter/CharterNoteGroup.hx | 4 ++-- source/funkin/editors/charter/CharterStrumline.hx | 2 +- source/funkin/editors/ui/UIState.hx | 4 ++-- source/funkin/editors/ui/UIUtil.hx | 6 ++++-- source/funkin/game/NoteGroup.hx | 8 ++++---- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/source/funkin/editors/charter/CharterNoteGroup.hx b/source/funkin/editors/charter/CharterNoteGroup.hx index 4c9a1d87..586907a3 100644 --- a/source/funkin/editors/charter/CharterNoteGroup.hx +++ b/source/funkin/editors/charter/CharterNoteGroup.hx @@ -60,14 +60,14 @@ class CharterNoteGroup extends FlxTypedGroup { public override function update(elapsed:Float) @:privateAccess { var oldDefaultCameras = FlxCamera._defaultCameras; - if (cameras != null) FlxCamera._defaultCameras = cameras; + if (_cameras != null) FlxCamera._defaultCameras = _cameras; if (autoSort && members.length != __lastSort) sortNotes(); forEach((n) -> { if(n.exists && n.active) { - n.cameras = n.__lastDrawCameras = cameras; + n._cameras = n.__lastDrawCameras = cameras; n.update(elapsed); } }); diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index 032521a6..0e91421d 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -32,7 +32,7 @@ class CharterStrumline extends UISprite { } return selectedWaveform = value; } - public var waveformShader:CustomShader; + public var waveformShader:CustomShader; public function new(strumLine:ChartStrumLine) { super(); diff --git a/source/funkin/editors/ui/UIState.hx b/source/funkin/editors/ui/UIState.hx index 47324848..34be9f9e 100644 --- a/source/funkin/editors/ui/UIState.hx +++ b/source/funkin/editors/ui/UIState.hx @@ -75,8 +75,8 @@ class UIState extends MusicBeatState { var pos = FlxG.mouse.getScreenPosition(camera, __point); __rect.copyFrom(rect); - __rect.x -= camera.scroll.x * spr.scrollFactor.x; - __rect.y -= camera.scroll.y * spr.scrollFactor.y; + __rect.x = __rect.x - camera.scroll.x * spr.scrollFactor.x; + __rect.y = __rect.y - camera.scroll.y * spr.scrollFactor.y; if (((pos.x > __rect.x) && (pos.x < __rect.x + __rect.width)) && ((pos.y > __rect.y) && (pos.y < __rect.y + __rect.height))) { return true; diff --git a/source/funkin/editors/ui/UIUtil.hx b/source/funkin/editors/ui/UIUtil.hx index 4a5a0ee4..4036184f 100644 --- a/source/funkin/editors/ui/UIUtil.hx +++ b/source/funkin/editors/ui/UIUtil.hx @@ -4,10 +4,12 @@ import flixel.input.FlxInput.FlxInputState; import flixel.input.keyboard.FlxKey; import funkin.editors.ui.UIContextMenu.UIContextMenuOption; +@:access(flixel.FlxSprite) class UIUtil { public static function follow(spr:FlxSprite, target:FlxSprite, x:Float = 0, y:Float = 0) { - spr.cameras = target is UISprite ? cast(target, UISprite).__lastDrawCameras : target.cameras; - spr.setPosition(target.x + x, target.y + y); + spr._cameras = target is UISprite ? cast(target, UISprite).__lastDrawCameras : target.cameras; + spr.x = target.x + x; + spr.y = target.y + y; spr.scrollFactor.set(target.scrollFactor.x, target.scrollFactor.y); } diff --git a/source/funkin/game/NoteGroup.hx b/source/funkin/game/NoteGroup.hx index 98b6477e..b539aed7 100644 --- a/source/funkin/game/NoteGroup.hx +++ b/source/funkin/game/NoteGroup.hx @@ -49,9 +49,9 @@ class NoteGroup extends FlxTypedGroup { } } - public override function draw() { - @:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras; - @:privateAccess if (cameras != null) FlxCamera._defaultCameras = cameras; + public override function draw() @:privateAccess { + var oldDefaultCameras = FlxCamera._defaultCameras; + if (_cameras != null) FlxCamera._defaultCameras = _cameras; var oldCur = __currentlyLooping; __currentlyLooping = true; @@ -68,7 +68,7 @@ class NoteGroup extends FlxTypedGroup { } __currentlyLooping = oldCur; - @:privateAccess FlxCamera._defaultCameras = oldDefaultCameras; + FlxCamera._defaultCameras = oldDefaultCameras; } /**