PROGRESS?? HOW DARE YOU

This commit is contained in:
Yoshman29
2023-04-20 19:35:58 +02:00
parent fa3b6d1953
commit 456a2f7f8d
6 changed files with 99 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<TextureAtlas imagePath="button.png">
<!-- Created without animate lol i wrote this-->
<SubTexture name="add-topleft" x="0" y="0" width="11" height="4"/>
<SubTexture name="add-top" x="11" y="0" width="19" height="4"/>
<SubTexture name="add-topright" x="30" y="0" width="18" height="4"/>
<SubTexture name="add-middleleft" x="0" y="4" width="11" height="26"/>
<SubTexture name="add-middle" x="11" y="4" width="19" height="26"/>
<SubTexture name="add-middleright" x="30" y="4" width="18" height="26"/>
<SubTexture name="add-bottomleft" x="0" y="30" width="11" height="4"/>
<SubTexture name="add-bottom" x="11" y="30" width="19" height="4"/>
<SubTexture name="add-bottomright" x="30" y="30" width="18" height="4"/>
<SubTexture name="edit-topleft" x="0" y="34" width="11" height="4"/>
<SubTexture name="edit-top" x="11" y="34" width="19" height="4"/>
<SubTexture name="edit-topright" x="30" y="34" width="18" height="4"/>
<SubTexture name="edit-middleleft" x="0" y="38" width="11" height="26"/>
<SubTexture name="edit-middle" x="11" y="38" width="19" height="26"/>
<SubTexture name="edit-middleright" x="30" y="38" width="18" height="26"/>
<SubTexture name="edit-bottomleft" x="0" y="64" width="11" height="4"/>
<SubTexture name="edit-bottom" x="11" y="64" width="19" height="4"/>
<SubTexture name="edit-bottomright" x="30" y="64" width="18" height="4"/>
</TextureAtlas>
File diff suppressed because one or more lines are too long
+33
View File
@@ -46,6 +46,7 @@ class Charter extends UIState {
public var topMenuSpr:UITopMenu;
public var gridBackdrop:CharterBackdrop;
public var eventsBackdrop:FlxBackdrop;
public var addEventSpr:CharterEventAdd;
public var beatSeparator:FlxBackdrop;
public var sectionSeparator:FlxBackdrop;
public var gridBackdropDummy:CharterBackdropDummy;
@@ -376,12 +377,17 @@ class Charter extends UIState {
strumlineInfoBG.cameras = [charterCamera];
strumLines.cameras = [charterCamera];
addEventSpr = new CharterEventAdd();
addEventSpr.alpha = 0;
addEventSpr.cameras = [charterCamera];
// adds grid and notes so that they're ALWAYS behind the UI
add(gridBackdrop);
add(sectionSeparator);
add(beatSeparator);
add(addEventSpr);
add(eventsGroup);
add(notesGroup);
add(topLimit);
@@ -611,6 +617,33 @@ class Charter extends UIState {
if (FlxG.mouse.justReleasedRight)
openContextMenu(topMenu[1].childs);
}
if (gridActionType == NONE && mousePos.x < 0) {
addEventSpr.incorporeal = false;
addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0.75, 0.25);
var event = getHoveredEvent(mousePos.y);
if (event != null) {
addEventSpr.updateEdit(event);
} else {
addEventSpr.updatePos(mousePos.y);
}
} else {
addEventSpr.incorporeal = true;
addEventSpr.sprAlpha = lerp(addEventSpr.sprAlpha, 0, 0.25);
}
}
public function getHoveredEvent(y:Float) {
var eventHovered:CharterEvent = null;
eventsGroup.forEach(function(e) {
if (eventHovered != null)
return;
if (e.hovered || (y >= e.y && y < (e.y + e.bHeight)))
eventHovered = e;
});
return eventHovered;
}
public function deleteNote(note:CharterNote, addToUndo:Bool = true):CharterNote {
@@ -29,12 +29,14 @@ class CharterEvent extends UISliceSprite {
super(-100, (step * 40) - 17, 100, 34, 'editors/charter/event-spr');
this.step = step;
this.events = events.getDefault([]);
cursor = BUTTON;
}
public override function update(elapsed:Float) {
super.update(elapsed);
for(k=>i in icons) {
i.follow(this, (k * 22) + 23 - (i.width / 2), (bHeight - i.height) / 2);
i.follow(this, (k * 22) + 30 - (i.width / 2), (bHeight - i.height) / 2);
}
}
@@ -69,7 +71,7 @@ class CharterEvent extends UISliceSprite {
f(event.type);
}
}
x = -(bWidth = 32 + (icons.length * 22));
x = -(bWidth = 37 + (icons.length * 22));
}
}
@@ -0,0 +1,38 @@
package funkin.editors.charter;
class CharterEventAdd extends UISliceSprite {
var text:UIText;
public var sprAlpha:Float = 0;
public function new() {
super(0, 0, 100, 34, 'editors/charter/event-spr-add');
text = new UIText(0, 0, 0, "");
members.push(text);
cursor = BUTTON;
}
public override function update(elapsed:Float) {
super.update(elapsed);
text.follow(this, 20, (bHeight - text.height) / 2);
alpha = sprAlpha * 0.75;
text.alpha = sprAlpha;
}
public function updatePos(y:Float) {
this.y = (FlxG.keys.pressed.SHIFT ? y : 40 * (Math.floor((y + 20) / 40))) - (bHeight / 2);
text.text = "Add event";
framesOffset = 0;
x = -(bWidth = 37 + Math.ceil(text.width));
}
public function updateEdit(event:CharterEvent) {
this.y = event.y;
text.text = "Edit";
framesOffset = 9;
x = -(bWidth = 27 + Math.ceil(text.width) + event.bWidth);
}
}