add batched notes to this branch

This commit is contained in:
lunarcleint
2025-03-14 14:14:03 -07:00
parent e68f241504
commit 326f4e1fe3
3 changed files with 43 additions and 7 deletions
@@ -89,8 +89,7 @@ class CharterBackdropGroup extends FlxTypedGroup<CharterBackdrop> {
notesGroup.forEach((n) -> {
if(n.exists && n.visible) {
var onStr:Bool = (n.snappedToGrid ? n.strumLineID : CoolUtil.boundInt(Std.int((n.x+n.width)/(40*strumLine.keyCount)), 0, strumLineGroup.members.length-1)) == i;
if(onStr)
grid.notesGroup.add(n);
if(onStr) grid.notesGroup.add(n);
}
});
@@ -118,8 +117,7 @@ class CharterBackdropGroup extends FlxTypedGroup<CharterBackdrop> {
if (cameras != null)
FlxCamera._defaultCameras = cameras;
while (i < length)
{
while (i < length) {
basic = members[i++];
if (basic != null && basic != draggingObj && basic.exists && basic.visible)
basic.draw();
@@ -130,6 +128,42 @@ class CharterBackdropGroup extends FlxTypedGroup<CharterBackdrop> {
}
}
// Batches note draws (neos idea) >:D -lunar
class NotesDrawGroup extends FlxFastTypedGroup<CharterNote> {
public override function draw() @:privateAccess {
var oldDefaultCameras = FlxCamera._defaultCameras;
if (cameras != null)
FlxCamera._defaultCameras = cameras;
var i:Int = 0;
var note:CharterNote = null;
while (i < length) {
note = members[i++];
if (note != null && note.exists && note.visible) {
if (note.snappedToGrid) note.x = (note.strumLine != null ? note.strumLine.x : 0) + (note.id % (note.strumLine != null ? note.strumLine.keyCount : 4)) * 40;
note.drawMembers();
}
}
i = 0; note = null;
while (i < length) {
note = members[i++];
if (note != null && note.exists && note.visible)
note.drawSuper();
}
i = 0; note = null;
while (i < length) {
note = members[i++];
if (note != null && note.exists && note.visible)
note.drawNoteTypeText();
}
FlxCamera._defaultCameras = oldDefaultCameras;
}
}
class CharterBackdrop extends FlxTypedGroup<FlxBasic> {
public var gridBackDrop:FlxBackdrop;
public var topLimit:FlxSprite;
@@ -143,7 +177,7 @@ class CharterBackdrop extends FlxTypedGroup<FlxBasic> {
public var beatSeparator:FlxBackdrop;
public var sectionSeparator:FlxBackdrop;
public var notesGroup:FlxFastTypedGroup<CharterNote> = new FlxFastTypedGroup<CharterNote>();
public var notesGroup:NotesDrawGroup = new NotesDrawGroup();
public var strumLine:CharterStrumline;
public var gridShader:CustomShader = new CustomShader("engine/charterGrid");
@@ -296,9 +296,7 @@ class CharterEventScreenNew extends MusicBeatSubstate {
Charter.instance.updateBPMEvents();
Charter.undos.addToUndo(CEditEvent(chartEvent, oldEvents, [for (event in events) Reflect.copy(event)]));
}
close();
}
@@ -201,6 +201,10 @@ class CharterNote extends UISprite implements ICharterSelectable {
drawMembers();
drawSuper();
drawNoteTypeText();
}
public inline function drawNoteTypeText() {
if(typeText.exists && typeText.visible && typeVisible) {
typeText.alpha = typeAlpha;
typeText.follow(this, 20 - (typeText.frameWidth/2), 20 - (typeText.frameHeight/2));