Small optimizations

This commit is contained in:
NeeEoo
2023-10-23 17:59:51 +02:00
parent 74834cf382
commit 27a2b45a5e
5 changed files with 14 additions and 14 deletions
+5 -8
View File
@@ -154,7 +154,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
{
if (__shouldDoScaleProcedure())
{
__oldScale = FlxPoint.get(scrollFactor.x, scrollFactor.y);
__oldScrollFactor.set(scrollFactor.x, scrollFactor.y);
var requestedZoom = FlxMath.lerp(initialZoom, camera.zoom, zoomFactor);
var diff = requestedZoom / camera.zoom;
@@ -162,9 +162,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
var r = super.getScreenPosition(point, Camera);
scrollFactor.set(__oldScale.x, __oldScale.y);
__oldScale.put();
__oldScale = null;
scrollFactor.set(__oldScrollFactor.x, __oldScrollFactor.y);
return r;
}
@@ -231,14 +229,15 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
private inline function __shouldDoScaleProcedure()
return zoomFactor != 1;
var __oldScale:FlxPoint;
static var __oldScrollFactor:FlxPoint = new FlxPoint();
static var __oldScale:FlxPoint = new FlxPoint();
var __skipZoomProcedure:Bool = false;
private function __doPreZoomScaleProcedure(camera:FlxCamera)
{
if (__skipZoomProcedure = !__shouldDoScaleProcedure())
return;
__oldScale = FlxPoint.get(scale.x, scale.y);
__oldScale.set(scale.x, scale.y);
var requestedZoom = FlxMath.lerp(initialZoom, camera.zoom, zoomFactor);
var diff = requestedZoom * camera.zoom;
@@ -250,8 +249,6 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I
if (__skipZoomProcedure)
return;
scale.set(__oldScale.x, __oldScale.y);
__oldScale.put();
__oldScale = null;
}
#end
@@ -21,6 +21,11 @@ class FlixelInfo extends FramerateCategory {
_text += '\nSounds Count: ${FlxG.sound.list.length}';
_text += '\nFlxG.game Childs Count: ${FlxG.game.numChildren}';
// _text += '\nCached objects count: ${cachedObjects}';
#if FLX_POINT_POOL
var points = flixel.math.FlxPoint.FlxBasePoint.pool;
//_text += '\nPoint Count: ${points._count} | +${points.made} | -${points.gotten} | ${points.balance} | >${points.putted}';
_text += '\nPoint Count: ${points._count}';
#end
}
this.text.text = _text;
-3
View File
@@ -48,10 +48,7 @@ class HudCamera extends FlxCamera {
public override function alterScreenPosition(spr:FlxObject, pos:FlxPoint) {
if (downscroll) {
var oldPoint = FlxPoint.get(pos.x, pos.y);
pos.set(pos.x, height - pos.y - spr.height);
oldPoint.put();
}
return pos;
}
+3 -2
View File
@@ -218,6 +218,7 @@ class Note extends FlxSprite
}
static var __notePosFrameOffset:FlxPoint = new FlxPoint();
static var __posPoint:FlxPoint = new FlxPoint();
override function draw() {
@:privateAccess var oldDefaultCameras = FlxCamera._defaultCameras;
@@ -227,7 +228,7 @@ class Note extends FlxSprite
if (negativeScroll) offset.y *= -1;
if (__strum != null && strumRelativePos) {
var pos = FlxPoint.get(x, y);
var pos = __posPoint.set(x, y);
setPosition(__strum.x, __strum.y);
@@ -246,7 +247,7 @@ class Note extends FlxSprite
frameOffset.y += __notePosFrameOffset.y;
setPosition(pos.x, pos.y);
pos.put();
//pos.put();
} else {
__notePosFrameOffset.set(0, 0);
super.draw();
+1 -1
View File
@@ -1160,7 +1160,7 @@ class PlayState extends MusicBeatState
pos.x += cpos.x;
pos.y += cpos.y;
r++;
cpos.put();
//cpos.put();
}
if (r > 0) {
pos.x /= r;