making dragging look a bit better (still need to add limits)
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -48,12 +48,9 @@ class Charter extends UIState {
|
||||
public var gridBackdrop:CharterBackdrop;
|
||||
public var eventsBackdrop:FlxBackdrop;
|
||||
public var addEventSpr:CharterEventAdd;
|
||||
public var beatSeparator:FlxBackdrop;
|
||||
public var sectionSeparator:FlxBackdrop;
|
||||
public var eventBeatSeparator:FlxBackdrop;
|
||||
public var eventSecSeparator:FlxBackdrop;
|
||||
public var gridBackdropDummy:CharterBackdropDummy;
|
||||
public var conductorFollowerSpr:FlxSprite;
|
||||
public var topLimit:FlxSprite;
|
||||
public var bottomLimit:FlxSprite;
|
||||
public var bottomSeparator:FlxSprite;
|
||||
|
||||
public var strumlineInfoBG:FlxSprite;
|
||||
@@ -267,12 +264,12 @@ class Charter extends UIState {
|
||||
null,
|
||||
{
|
||||
label: 'Show Sections Separator',
|
||||
onSelect: _view_showsectionseparator,
|
||||
onSelect: _view_showeventSecSeparator,
|
||||
icon: Options.charterShowSections ? 1 : 0
|
||||
},
|
||||
{
|
||||
label: 'Show Beats Separator',
|
||||
onSelect: _view_showbeatseparator,
|
||||
onSelect: _view_showeventBeatSeparator,
|
||||
icon: Options.charterShowBeats ? 1 : 0
|
||||
}
|
||||
]
|
||||
@@ -353,15 +350,15 @@ class Charter extends UIState {
|
||||
add(eventsBackdrop);
|
||||
|
||||
add(gridBackdropDummy = new CharterBackdropDummy(gridBackdrop));
|
||||
sectionSeparator = new FlxBackdrop(null, Y, 0, 0);
|
||||
sectionSeparator.x = -20;
|
||||
sectionSeparator.y = -2;
|
||||
sectionSeparator.visible = Options.charterShowSections;
|
||||
beatSeparator = new FlxBackdrop(null, Y, 0, 0);
|
||||
beatSeparator.x = -10;
|
||||
beatSeparator.y = -1;
|
||||
sectionSeparator.visible = Options.charterShowBeats;
|
||||
for(sep in [sectionSeparator, beatSeparator]) {
|
||||
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);
|
||||
@@ -373,11 +370,7 @@ class Charter extends UIState {
|
||||
selectionBox.scrollFactor.set(1, 1);
|
||||
selectionBox.incorporeal = true;
|
||||
|
||||
conductorFollowerSpr = new FlxSprite(0, 0).makeGraphic(1, 1, -1);
|
||||
conductorFollowerSpr.scale.set(gridBackdrop.strumlinesAmount * 4 * 40, 4);
|
||||
conductorFollowerSpr.updateHitbox();
|
||||
|
||||
conductorFollowerSpr.cameras = selectionBox.cameras = notesGroup.cameras = gridBackdrop.cameras = [charterCamera];
|
||||
selectionBox.cameras = notesGroup.cameras = gridBackdrop.cameras = [charterCamera];
|
||||
|
||||
topMenuSpr = new UITopMenu(topMenu);
|
||||
topMenuSpr.cameras = uiGroup.cameras = [uiCamera];
|
||||
@@ -394,16 +387,6 @@ class Charter extends UIState {
|
||||
songPosInfo.alignment = RIGHT;
|
||||
uiGroup.add(songPosInfo);
|
||||
|
||||
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;
|
||||
|
||||
bottomSeparator = new FlxSprite();
|
||||
bottomSeparator.makeGraphic(1, 1, -1);
|
||||
bottomSeparator.alpha = 0.5;
|
||||
@@ -431,15 +414,14 @@ class Charter extends UIState {
|
||||
|
||||
// adds grid and notes so that they're ALWAYS behind the UI
|
||||
add(gridBackdrop);
|
||||
add(sectionSeparator);
|
||||
add(beatSeparator);
|
||||
add(eventSecSeparator);
|
||||
add(eventBeatSeparator);
|
||||
add(addEventSpr);
|
||||
add(eventsGroup);
|
||||
add(notesGroup);
|
||||
add(topLimit);
|
||||
add(bottomLimit);
|
||||
add(bottomSeparator);
|
||||
add(conductorFollowerSpr);
|
||||
add(selectionBox);
|
||||
add(strumlineInfoBG);
|
||||
add(strumlineAddButton);
|
||||
@@ -909,8 +891,8 @@ class Charter extends UIState {
|
||||
if (gridBackdrop.strumlinesAmount != strumLines.members.length)
|
||||
updateDisplaySprites();
|
||||
|
||||
sectionSeparator.spacing.y = (10 * Conductor.beatsPerMesure * Conductor.stepsPerBeat) - 1;
|
||||
beatSeparator.spacing.y = (20 * Conductor.stepsPerBeat) - 1;
|
||||
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) {
|
||||
@@ -947,16 +929,19 @@ class Charter extends UIState {
|
||||
+ '\nTime Signature: ${Conductor.beatsPerMesure}/${Conductor.stepsPerBeat}';
|
||||
|
||||
if (FlxG.sound.music.playing) {
|
||||
conductorFollowerSpr.y = curStepFloat * 40;
|
||||
gridBackdrop.conductorFollowerSpr.y = curStepFloat * 40;
|
||||
} else {
|
||||
conductorFollowerSpr.y = lerp(conductorFollowerSpr.y, curStepFloat * 40, 1/3);
|
||||
}
|
||||
charterCamera.scroll.set(conductorFollowerSpr.x + ((conductorFollowerSpr.scale.x - FlxG.width) / 2), conductorFollowerSpr.y - (FlxG.height * 0.5));
|
||||
if (charterCamera.zoom != (charterCamera.zoom = lerp(charterCamera.zoom, __camZoom, 0.125))) {
|
||||
updateDisplaySprites();
|
||||
gridBackdrop.conductorFollowerSpr.y = lerp(gridBackdrop.conductorFollowerSpr.y, curStepFloat * 40, 1/3);
|
||||
}
|
||||
charterCamera.scroll.set(
|
||||
(((gridBackdrop.conductorFollowerSpr.scale.x * gridBackdrop.strumlinesAmount) - FlxG.width) / 2),
|
||||
gridBackdrop.conductorFollowerSpr.y - (FlxG.height * 0.5)
|
||||
);
|
||||
|
||||
WindowTitle.prefix = undos.unsaved ? "● " : "";
|
||||
if (charterCamera.zoom != (charterCamera.zoom = lerp(charterCamera.zoom, __camZoom, 0.125)))
|
||||
updateDisplaySprites();
|
||||
|
||||
WindowTitle.prefix = undos.unsaved ? "* " : "";
|
||||
strumLines.sort(function(o, a, b) return FlxSort.byValues(o, a.x - 80, b.x - 80), -1);
|
||||
for (it=>i in strumLines.members)
|
||||
if (!i.dragging) i.x = CoolUtil.fpsLerp(i.x, 160 * it, 0.3);
|
||||
@@ -968,14 +953,11 @@ class Charter extends UIState {
|
||||
function updateDisplaySprites() {
|
||||
gridBackdrop.strumlinesAmount = strumLines.members.length;
|
||||
|
||||
conductorFollowerSpr.scale.set(gridBackdrop.strumlinesAmount * 4 * 40, 4);
|
||||
conductorFollowerSpr.updateHitbox();
|
||||
eventSecSeparator.scale.set(20, 4);
|
||||
eventSecSeparator.updateHitbox();
|
||||
|
||||
sectionSeparator.scale.set((gridBackdrop.strumlinesAmount * 4 * 40) + 20, 4);
|
||||
sectionSeparator.updateHitbox();
|
||||
|
||||
beatSeparator.scale.set((gridBackdrop.strumlinesAmount * 4 * 40) + 10, 2);
|
||||
beatSeparator.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));
|
||||
@@ -1260,13 +1242,13 @@ class Charter extends UIState {
|
||||
zoom = 0;
|
||||
__camZoom = Math.pow(2, zoom);
|
||||
}
|
||||
function _view_showsectionseparator(t) {
|
||||
function _view_showeventSecSeparator(t) {
|
||||
t.icon = (Options.charterShowSections = !Options.charterShowSections) ? 1 : 0;
|
||||
sectionSeparator.visible = Options.charterShowSections;
|
||||
eventSecSeparator.visible = gridBackdrop.sectionSeparator.visible = Options.charterShowSections;
|
||||
}
|
||||
function _view_showbeatseparator(t) {
|
||||
function _view_showeventBeatSeparator(t) {
|
||||
t.icon = (Options.charterShowBeats = !Options.charterShowBeats) ? 1 : 0;
|
||||
beatSeparator.visible = Options.charterShowBeats;
|
||||
eventBeatSeparator.visible = gridBackdrop.beatSeparator.visible = Options.charterShowBeats;
|
||||
}
|
||||
|
||||
inline function _note_addsustain(t)
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
package funkin.editors.charter;
|
||||
|
||||
import funkin.backend.system.Conductor;
|
||||
import openfl.geom.Rectangle;
|
||||
import flixel.addons.display.FlxBackdrop;
|
||||
|
||||
class CharterBackdrop extends FlxBackdrop {
|
||||
public var strumlinesAmount:Int = 1;
|
||||
|
||||
public var conductorFollowerSpr:FlxSprite;
|
||||
public var beatSeparator:FlxBackdrop;
|
||||
public var sectionSeparator:FlxBackdrop;
|
||||
|
||||
public function new() {
|
||||
super(null, Y, 0, 0);
|
||||
|
||||
@@ -21,7 +26,28 @@ class CharterBackdrop extends FlxBackdrop {
|
||||
pixels.fillRect(new Rectangle(0, 0, 1, 160), 0xFFDDDDDD);
|
||||
pixels.fillRect(new Rectangle(159, 0, 1, 160), 0xFFDDDDDD);
|
||||
pixels.unlock();
|
||||
// loadFrame(frame);
|
||||
|
||||
// Seperators
|
||||
sectionSeparator = new FlxBackdrop(null, Y, 0, 0);
|
||||
sectionSeparator.y = -2;
|
||||
sectionSeparator.visible = Options.charterShowSections;
|
||||
|
||||
beatSeparator = new FlxBackdrop(null, Y, 0, 0);
|
||||
beatSeparator.y = -1;
|
||||
beatSeparator.visible = Options.charterShowBeats;
|
||||
|
||||
for(sep in [sectionSeparator, beatSeparator]) {
|
||||
sep.makeGraphic(1, 1, -1);
|
||||
sep.alpha = 0.5;
|
||||
sep.scrollFactor.set(1, 1);
|
||||
sep.scale.set((4 * 40), sep == sectionSeparator ? 4 : 2);
|
||||
sep.updateHitbox();
|
||||
}
|
||||
|
||||
// Follower
|
||||
conductorFollowerSpr = new FlxSprite(0, 0).makeGraphic(1, 1, -1);
|
||||
conductorFollowerSpr.scale.set(4 * 40, 4);
|
||||
conductorFollowerSpr.updateHitbox();
|
||||
}
|
||||
|
||||
public override function draw() {
|
||||
@@ -30,9 +56,22 @@ class CharterBackdrop extends FlxBackdrop {
|
||||
if (Charter.instance.strumLines.members[_] != null) {
|
||||
x = Charter.instance.strumLines.members[_].x;
|
||||
alpha = Charter.instance.strumLines.members[_].strumLine.visible ? 1 : 0.4;
|
||||
}
|
||||
else alpha = 0.9;
|
||||
} else alpha = 0.9;
|
||||
|
||||
sectionSeparator.spacing.y = (10 * Conductor.beatsPerMesure * Conductor.stepsPerBeat) - 1;
|
||||
beatSeparator.spacing.y = (20 * Conductor.stepsPerBeat) - 1;
|
||||
|
||||
super.draw();
|
||||
|
||||
for (sep in [sectionSeparator, beatSeparator]) {
|
||||
sep.x = this.x;
|
||||
sep.cameras = this.cameras;
|
||||
if (sep.visible) sep.draw();
|
||||
}
|
||||
|
||||
conductorFollowerSpr.x = this.x;
|
||||
conductorFollowerSpr.cameras = this.cameras;
|
||||
if (conductorFollowerSpr.visible) conductorFollowerSpr.draw();
|
||||
}
|
||||
x = ogX;
|
||||
}
|
||||
|
||||
@@ -17,18 +17,18 @@ class CharterNoteGroup extends FlxTypedGroup<CharterNote> {
|
||||
__currentlyLooping = true;
|
||||
|
||||
var curStep = Conductor.curStepFloat;
|
||||
if (FlxG.state is Charter && !FlxG.sound.music.playing)
|
||||
curStep = cast(FlxG.state, Charter).conductorFollowerSpr.y / 40;
|
||||
if (!FlxG.sound.music.playing)
|
||||
curStep = Charter.instance.gridBackdrop.conductorFollowerSpr.y / 40;
|
||||
|
||||
var begin = SortedArrayUtil.binarySearch(members, curStep - max, getVarForEachAdd);
|
||||
var end = SortedArrayUtil.binarySearch(members, curStep + max, getVarForEachRemove);
|
||||
|
||||
for(i in begin...end) {
|
||||
__loopSprite = members[i];
|
||||
if (!cast(FlxG.state, Charter).selection.contains(__loopSprite))
|
||||
if (!Charter.instance.selection.contains(__loopSprite))
|
||||
noteFunc(__loopSprite);
|
||||
}
|
||||
for(c in cast(FlxG.state, Charter).selection.copy())
|
||||
for(c in Charter.instance.selection.copy())
|
||||
if (c is CharterNote) noteFunc(cast (c, CharterNote));
|
||||
|
||||
__currentlyLooping = oldCur;
|
||||
|
||||
Reference in New Issue
Block a user