seperate each strum and events

This commit is contained in:
lunarcleint
2023-08-26 12:56:00 -07:00
parent 22638048d8
commit 5d9baa6a3d
2 changed files with 133 additions and 58 deletions
+8 -58
View File
@@ -1,5 +1,6 @@
package funkin.editors.charter;
import funkin.editors.charter.CharterBackdrop.EventBackdrop;
import funkin.backend.system.framerate.Framerate;
import haxe.Json;
import flixel.input.keyboard.FlxKey;
@@ -46,12 +47,9 @@ class Charter extends UIState {
public var topMenuSpr:UITopMenu;
public var gridBackdrop:CharterBackdrop;
public var eventsBackdrop:FlxBackdrop;
public var eventsBackdrop:EventBackdrop;
public var addEventSpr:CharterEventAdd;
public var eventBeatSeparator:FlxBackdrop;
public var eventSecSeparator:FlxBackdrop;
public var gridBackdropDummy:CharterBackdropDummy;
public var bottomSeparator:FlxSprite;
public var strumlineInfoBG:FlxSprite;
public var strumlineAddButton:CharterStrumlineExtraButton;
@@ -343,28 +341,11 @@ class Charter extends UIState {
gridBackdrop = new CharterBackdrop();
eventsBackdrop = new FlxBackdrop(Paths.image('editors/charter/events-grid'), Y, 0, 0);
eventsBackdrop = new EventBackdrop();
eventsBackdrop.x = -eventsBackdrop.width;
eventsBackdrop.alpha = 0.9;
eventsBackdrop.cameras = [charterCamera];
add(eventsBackdrop);
add(gridBackdropDummy = new CharterBackdropDummy(gridBackdrop));
eventSecSeparator = new FlxBackdrop(null, Y, 0, 0);
eventSecSeparator.x = -20;
eventSecSeparator.y = -2;
eventSecSeparator.visible = Options.charterShowSections;
eventBeatSeparator = new FlxBackdrop(null, Y, 0, 0);
eventBeatSeparator.x = -10;
eventBeatSeparator.y = -1;
eventSecSeparator.visible = Options.charterShowBeats;
for(sep in [eventSecSeparator, eventBeatSeparator]) {
sep.makeGraphic(1, 1, -1);
sep.alpha = 0.5;
sep.scrollFactor.set(1, 1);
sep.cameras = [charterCamera];
}
selectionBox = new UISliceSprite(0, 0, 2, 2, 'editors/ui/selection');
selectionBox.visible = false;
selectionBox.scrollFactor.set(1, 1);
@@ -387,15 +368,6 @@ class Charter extends UIState {
songPosInfo.alignment = RIGHT;
uiGroup.add(songPosInfo);
bottomSeparator = new FlxSprite();
bottomSeparator.makeGraphic(1, 1, -1);
bottomSeparator.alpha = 0.5;
bottomSeparator.scrollFactor.set(1, 1);
bottomSeparator.cameras = [charterCamera];
bottomSeparator.x = -20;
bottomSeparator.y = -2;
strumlineInfoBG = new UISprite();
strumlineInfoBG.loadGraphic(Paths.image('editors/charter/strumline-info-bg'));
strumlineInfoBG.y = 23;
@@ -414,14 +386,10 @@ class Charter extends UIState {
// adds grid and notes so that they're ALWAYS behind the UI
add(gridBackdrop);
add(eventSecSeparator);
add(eventBeatSeparator);
add(eventsBackdrop);
add(addEventSpr);
add(eventsGroup);
add(notesGroup);
add(topLimit);
add(bottomLimit);
add(bottomSeparator);
add(selectionBox);
add(strumlineInfoBG);
add(strumlineAddButton);
@@ -491,8 +459,8 @@ class Charter extends UIState {
var length = FlxG.sound.music.getDefault(vocals).length;
scrollBar.length = Conductor.getStepForTime(length);
bottomLimit.y = Conductor.getStepForTime(length) * 40;
bottomSeparator.y = bottomLimit.y-2;
gridBackdrop.bottomLimit.y = Conductor.getStepForTime(length) * 40;
eventsBackdrop.bottomSeparator.y = gridBackdrop.bottomSeparator.y = gridBackdrop.bottomLimit.y-2;
}
public override function beatHit(curBeat:Int) {
@@ -891,9 +859,6 @@ class Charter extends UIState {
if (gridBackdrop.strumlinesAmount != strumLines.members.length)
updateDisplaySprites();
eventSecSeparator.spacing.y = (10 * Conductor.beatsPerMesure * Conductor.stepsPerBeat) - 1;
eventBeatSeparator.spacing.y = (20 * Conductor.stepsPerBeat) - 1;
// TODO: canTypeText in case an ui input element is focused
if (true) {
__crochet = ((60 / Conductor.bpm) * 1000);
@@ -953,22 +918,7 @@ class Charter extends UIState {
function updateDisplaySprites() {
gridBackdrop.strumlinesAmount = strumLines.members.length;
eventSecSeparator.scale.set(20, 4);
eventSecSeparator.updateHitbox();
eventBeatSeparator.scale.set(10, 2);
eventBeatSeparator.updateHitbox();
charterBG.scale.set(1 / charterCamera.zoom, 1 / charterCamera.zoom);
topLimit.scale.set(gridBackdrop.strumlinesAmount * 4 * 40, Math.ceil(FlxG.height / charterCamera.zoom));
topLimit.updateHitbox();
topLimit.y = -topLimit.height;
bottomLimit.scale.set(gridBackdrop.strumlinesAmount * 4 * 40, Math.ceil(FlxG.height / charterCamera.zoom));
bottomLimit.updateHitbox();
bottomSeparator.scale.set((gridBackdrop.strumlinesAmount * 4 * 40) + 20, 4);
bottomSeparator.updateHitbox();
strumlineInfoBG.scale.set(FlxG.width / charterCamera.zoom, 1);
strumlineInfoBG.updateHitbox();
@@ -1244,11 +1194,11 @@ class Charter extends UIState {
}
function _view_showeventSecSeparator(t) {
t.icon = (Options.charterShowSections = !Options.charterShowSections) ? 1 : 0;
eventSecSeparator.visible = gridBackdrop.sectionSeparator.visible = Options.charterShowSections;
eventsBackdrop.eventSecSeparator.visible = gridBackdrop.sectionSeparator.visible = Options.charterShowSections;
}
function _view_showeventBeatSeparator(t) {
t.icon = (Options.charterShowBeats = !Options.charterShowBeats) ? 1 : 0;
eventBeatSeparator.visible = gridBackdrop.beatSeparator.visible = Options.charterShowBeats;
eventsBackdrop.eventBeatSeparator.visible = gridBackdrop.beatSeparator.visible = Options.charterShowBeats;
}
inline function _note_addsustain(t)
@@ -7,6 +7,11 @@ import flixel.addons.display.FlxBackdrop;
class CharterBackdrop extends FlxBackdrop {
public var strumlinesAmount:Int = 1;
public var topLimit:FlxSprite;
public var topSeparator:FlxSprite;
public var bottomLimit:FlxSprite;
public var bottomSeparator:FlxSprite;
public var conductorFollowerSpr:FlxSprite;
public var beatSeparator:FlxBackdrop;
public var sectionSeparator:FlxBackdrop;
@@ -44,6 +49,31 @@ class CharterBackdrop extends FlxBackdrop {
sep.updateHitbox();
}
bottomSeparator = new FlxSprite(0,-2);
bottomSeparator.makeGraphic(1, 1, -1);
bottomSeparator.alpha = 0.5;
bottomSeparator.scrollFactor.set(1, 1);
bottomSeparator.scale.set(4 * 40, 4);
bottomSeparator.updateHitbox();
topSeparator = new FlxSprite(0, -2);
topSeparator.makeGraphic(1, 1, -1);
topSeparator.alpha = 0.5;
topSeparator.scrollFactor.set(1, 1);
topSeparator.scale.set(4 * 40, 4);
topSeparator.updateHitbox();
// Limits
topLimit = new FlxSprite();
topLimit.makeGraphic(1, 1, -1);
topLimit.color = 0xFF888888;
topLimit.blend = MULTIPLY;
bottomLimit = new FlxSprite();
bottomLimit.makeGraphic(1, 1, -1);
bottomLimit.color = 0xFF888888;
bottomLimit.blend = MULTIPLY;
// Follower
conductorFollowerSpr = new FlxSprite(0, 0).makeGraphic(1, 1, -1);
conductorFollowerSpr.scale.set(4 * 40, 4);
@@ -69,6 +99,29 @@ class CharterBackdrop extends FlxBackdrop {
if (sep.visible) sep.draw();
}
topLimit.x = this.x;
topLimit.cameras = this.cameras;
topLimit.scale.set(4 * 40, Math.ceil(FlxG.height / cameras[0].zoom));
topLimit.updateHitbox();
topLimit.y = -topLimit.height;
topLimit.draw();
bottomLimit.x = this.x;
bottomLimit.cameras = this.cameras;
bottomLimit.scale.set(4 * 40, Math.ceil(FlxG.height / cameras[0].zoom));
bottomLimit.updateHitbox();
bottomLimit.draw();
topSeparator.x = this.x;
topSeparator.cameras = this.cameras;
if (!sectionSeparator.visible) topSeparator.draw();
bottomSeparator.x = this.x;
bottomSeparator.cameras = this.cameras;
bottomSeparator.draw();
conductorFollowerSpr.x = this.x;
conductorFollowerSpr.cameras = this.cameras;
if (conductorFollowerSpr.visible) conductorFollowerSpr.draw();
@@ -95,4 +148,76 @@ class CharterBackdropDummy extends UISprite {
@:privateAccess
__lastDrawCameras = [for(c in cameras) c];
}
}
class EventBackdrop extends FlxBackdrop {
public var eventBeatSeparator:FlxBackdrop;
public var eventSecSeparator:FlxBackdrop;
public var topSeparator:FlxSprite;
public var bottomSeparator:FlxSprite;
public function new() {
super(Paths.image('editors/charter/events-grid'), Y, 0, 0);
alpha = 0.9;
// Separators
eventSecSeparator = new FlxBackdrop(null, Y, 0, 0);
eventSecSeparator.y = -2;
eventSecSeparator.visible = Options.charterShowSections;
eventBeatSeparator = new FlxBackdrop(null, Y, 0, 0);
eventBeatSeparator.y = -1;
eventBeatSeparator.visible = Options.charterShowBeats;
for(sep in [eventSecSeparator, eventBeatSeparator]) {
sep.makeGraphic(1, 1, -1);
sep.alpha = 0.5;
sep.scrollFactor.set(1, 1);
}
eventSecSeparator.scale.set(20, 4);
eventSecSeparator.updateHitbox();
eventBeatSeparator.scale.set(10, 2);
eventBeatSeparator.updateHitbox();
bottomSeparator = new FlxSprite(0,-2);
bottomSeparator.makeGraphic(1, 1, -1);
bottomSeparator.alpha = 0.5;
bottomSeparator.scrollFactor.set(1, 1);
bottomSeparator.scale.set(20, 4);
bottomSeparator.updateHitbox();
topSeparator = new FlxSprite(0, -2);
topSeparator.makeGraphic(1, 1, -1);
topSeparator.alpha = 0.5;
topSeparator.scrollFactor.set(1, 1);
topSeparator.scale.set(20, 4);
topSeparator.updateHitbox();
}
public override function draw() {
super.draw();
eventSecSeparator.spacing.y = (10 * Conductor.beatsPerMesure * Conductor.stepsPerBeat) - 1;
eventBeatSeparator.spacing.y = (20 * Conductor.stepsPerBeat) - 1;
eventSecSeparator.cameras = cameras;
eventSecSeparator.x = (x+width) - 20;
if (eventSecSeparator.visible) eventSecSeparator.draw();
eventBeatSeparator.cameras = cameras;
eventBeatSeparator.x = (x+width) - 10;
if (eventBeatSeparator.visible) eventBeatSeparator.draw();
topSeparator.x = (x+width) - 20;
topSeparator.cameras = this.cameras;
if (!eventSecSeparator.visible) topSeparator.draw();
bottomSeparator.x = (x+width) - 20;
bottomSeparator.cameras = this.cameras;
bottomSeparator.draw();
}
}