mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-02-06 03:28:08 +00:00
stinky dipshit specto viz optimization
This commit is contained in:
parent
44e720ee28
commit
0b9c9d7533
|
@ -46,6 +46,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
{
|
||||
var lineShit:FlxSprite = new FlxSprite(100, i / lengthOfShit * daHeight).makeGraphic(1, 1, col);
|
||||
lineShit.active = false;
|
||||
lineShit.ID = i;
|
||||
add(lineShit);
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +57,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
|
||||
var numSamples:Int = 0;
|
||||
|
||||
public var wavOptimiz:Int = 10;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
switch (visType)
|
||||
|
@ -68,6 +71,11 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
default:
|
||||
}
|
||||
|
||||
forEach(spr ->
|
||||
{
|
||||
spr.visible = FlxG.game.ticks % wavOptimiz == spr.ID % wavOptimiz;
|
||||
});
|
||||
|
||||
// if visType is static, call updateVisulizer() manually whenever you want to update it!
|
||||
|
||||
super.update(elapsed);
|
||||
|
@ -110,6 +118,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
group.members[i].setGraphicSize(Std.int(Math.max(line.length, 1)), Std.int(1));
|
||||
group.members[i].angle = line.degrees;
|
||||
}
|
||||
|
||||
wavOptimiz = 1; // hard set wavOptimiz to 1 so its a pure thing
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -234,6 +244,8 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
}
|
||||
}
|
||||
|
||||
var curTime:Float = 0;
|
||||
|
||||
public function updateVisulizer():Void
|
||||
{
|
||||
if (vis.snd != null)
|
||||
|
@ -247,7 +259,19 @@ class SpectogramSprite extends FlxTypedSpriteGroup<FlxSprite>
|
|||
if (vis.snd.playing)
|
||||
remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, numSamples));
|
||||
else
|
||||
{
|
||||
if (curTime == Conductor.songPosition)
|
||||
{
|
||||
wavOptimiz = 3;
|
||||
return; // already did shit, so finishes function early
|
||||
}
|
||||
|
||||
curTime = Conductor.songPosition;
|
||||
|
||||
remappedShit = Std.int(FlxMath.remapToRange(Conductor.songPosition, 0, vis.snd.length, 0, numSamples));
|
||||
}
|
||||
|
||||
wavOptimiz = 8;
|
||||
|
||||
var i = remappedShit;
|
||||
var prevLine:FlxPoint = new FlxPoint();
|
||||
|
|
|
@ -1166,7 +1166,7 @@ class ChartingState extends MusicBeatState
|
|||
}
|
||||
|
||||
// generates the cool sidebar shit
|
||||
if (sidePreview != null)
|
||||
if (sidePreview != null && sidePreview.active)
|
||||
{
|
||||
sidePreview.drawRect(0, 0, 40, FlxG.height, 0xFF444444);
|
||||
|
||||
|
|
Loading…
Reference in a new issue