This commit is contained in:
lunarcleint
2023-08-12 16:28:19 -07:00
29 changed files with 139 additions and 77 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ float uBlur = 0.015;
float uBrightness = 0.6;
vec4 getColor(vec2 pos) {
vec2 ps = camToOg(pos);
vec2 ps = (pos);
if (ps.x < 0) ps.x = 0;
//else if (ps.x > 1.0 - (1.0 / iResolution.x)) ps.x = 1.0 - (1.0 / iResolution.x);
else if (ps.x > 1.0) return vec4(0.0);
@@ -40,7 +40,7 @@ vec2 random(vec2 p) {
}
void main() {
vec2 camPos = getCamPos(openfl_TextureCoordv);
vec2 camPos = (openfl_TextureCoordv);
//vec2 camPos = openfl_TextureCoordv;
if (camPos.x < 0 || camPos.x > 1 || camPos.y < 0 || camPos.y > 1)
return;
@@ -16,6 +16,7 @@ class CommandLineHandler {
Sys.println("-mod [mod name] | Load a specific mod");
Sys.println("-modfolder [path] | Sets the mod folder path");
#end
Sys.println("-nocolor | Disables colors in the terminal");
Sys.println("-nogpubitmap | Forces GPU only bitmaps off");
Sys.exit(0);
#if MOD_SUPPORT
@@ -28,8 +29,6 @@ class CommandLineHandler {
} else {
Main.modToLoad = arg.trim();
}
case "-nogpubitmap":
Main.forceGPUOnlyBitmapsOff = true;
case "-modfolder":
i++;
var arg = cmd[i];
@@ -43,6 +42,10 @@ class CommandLineHandler {
Sys.exit(0);
}
#end
case "-nocolor":
Main.noTerminalColor = true;
case "-nogpubitmap":
Main.forceGPUOnlyBitmapsOff = true;
case "-livereload":
// do nothing
default:
+1
View File
@@ -39,6 +39,7 @@ class Main extends Sprite
public static var modToLoad:String = null;
public static var forceGPUOnlyBitmapsOff:Bool = false;
public static var noTerminalColor:Bool = false;
public static var scaleMode:FunkinRatioScaleMode;
#if !mobile
+2
View File
@@ -50,6 +50,8 @@ class NativeAPI {
* Sets the console colors
*/
public static function setConsoleColors(foregroundColor:ConsoleColor = NONE, ?backgroundColor:ConsoleColor = NONE) {
if(Main.noTerminalColor) return;
#if (windows && !hl)
if(foregroundColor == NONE)
foregroundColor = LIGHTGRAY;
-1
View File
@@ -10,7 +10,6 @@ class DebugOptions extends TreeMenu {
super.create();
FlxG.camera.fade(0xFF000000, 0.5, true);
var bg:FlxSprite = new FlxSprite(-80).loadAnimatedGraphic(Paths.image('menus/menuBGBlue'));
// bg.scrollFactor.set();
@@ -58,7 +58,7 @@ class CharacterAnimButtons extends UIButton {
public override function update(elapsed:Float) {
editButton.selectable = ghostButton.selectable = deleteButton.selectable = selectable;
editButton.shouldPress = ghostButton.shouldPress = deleteButton.shouldPress = shouldPress;
hovered = !deleteButton.hovered;
updatePos();
super.update(elapsed);
@@ -117,7 +117,7 @@ class CharacterAnimScreen extends UISubstateWindow {
if (i != null)
animData.indices.push(i);
}
if (onSave != null) onSave(animData);
}
}
@@ -33,7 +33,7 @@ class CharacterEditor extends UIState {
// WINDOWS
public var characterPropertiresWindow:CharacterPropertiesWindow;
public var characterAnimsWindow:UIButtonList<CharacterAnimButtons>;
// camera for the character itself so that it can be unzoomed/zoomed in again
public var charCamera:FlxCamera;
// camera for the animations list
@@ -51,7 +51,7 @@ class CharacterEditor extends UIState {
public override function create() {
super.create();
topMenu = [
{
label: "File",
@@ -334,7 +334,7 @@ class CharacterEditor extends UIState {
function _file_save(_) {
#if sys
sys.io.File.saveContent(
Assets.getPath(Paths.xml('characters/${character.curCharacter}')),
Assets.getPath(Paths.xml('characters/${character.curCharacter}')),
buildCharacter()
);
return;
@@ -386,7 +386,7 @@ class CharacterEditor extends UIState {
character.animOffsets.set(anim, offsets.clone());
ghosts.setOffsets(anim, offsets.clone());
}
for (charButton in characterAnimsWindow.buttons.members)
charButton.updateInfo(charButton.anim, character.getAnimOffset(charButton.anim), ghosts.animGhosts[charButton.anim].visible);
@@ -462,7 +462,7 @@ class CharacterEditor extends UIState {
public function editAnim(name:String, animData:AnimData, addtoUndo:Bool = true) {
var oldAnimData:AnimData = character.animDatas.get(name);
var buttoner:CharacterAnimButtons = null;
for (button in characterAnimsWindow.buttons.members)
for (button in characterAnimsWindow.buttons.members)
if (button.anim == name) buttoner = button;
ghosts.removeGhost(name);
@@ -528,7 +528,7 @@ class CharacterEditor extends UIState {
ghost.visible = !ghost.visible;
var animButton:CharacterAnimButtons = null;
for (button in characterAnimsWindow.buttons.members)
for (button in characterAnimsWindow.buttons.members)
if (button.anim == anim) animButton = button;
animButton.updateInfo(anim, character.getAnimOffset(anim), ghost.visible);
}
@@ -590,8 +590,8 @@ class CharacterEditor extends UIState {
if (character.getNameList().length == 0) return;
character.animOffsets.set(anim, character.getAnimOffset(anim) + change);
for (i in characterAnimsWindow.buttons.members)
if (i.anim == anim)
for (i in characterAnimsWindow.buttons.members)
if (i.anim == anim)
i.updateInfo(anim, character.getAnimOffset(anim), ghosts.animGhosts[anim].visible);
character.frameOffset.set(character.getAnimOffset(anim).x, character.getAnimOffset(anim).y);
@@ -610,8 +610,8 @@ class CharacterEditor extends UIState {
];
for (anim in character.getNameList()) {
character.animOffsets[anim].zero();
for (i in characterAnimsWindow.buttons.members)
if (i.anim == anim)
for (i in characterAnimsWindow.buttons.members)
if (i.anim == anim)
i.updateInfo(anim, character.getAnimOffset(anim), ghosts.animGhosts[anim].visible);
}
@@ -12,7 +12,7 @@ class CharacterGhostsHandler extends FlxTypedGroup<Character> {
this.character = character;
super();
for (anim in character.getNameList())
for (anim in character.getNameList())
createGhost(anim);
}
@@ -21,7 +21,7 @@ class CharacterGhostsHandler extends FlxTypedGroup<Character> {
ghost.applyXML(character.xml); // apply cur character stuff
ghost.playAnim(anim);
ghost.stopAnimation();
ghost.alpha = 0.5;
ghost.alpha = 0.5;
ghost.visible = false;
add(ghost);
@@ -69,7 +69,7 @@ class CharacterGhostsHandler extends FlxTypedGroup<Character> {
}
inline function rePositionGhosts() {
for (ghost in animGhosts)
for (ghost in animGhosts)
ghost.frameOffset.set(ghost.getAnimOffset(ghost.getAnimName()).x, ghost.getAnimOffset(ghost.getAnimName()).y);
}
}
@@ -37,7 +37,6 @@ class CharacterSelection extends EditorTreeMenu
override function createPost() {
super.createPost();
var idk:OptionsScreen = optionsTree.members.last();
if (idk.members.length > 0) idk.changeSelection(1);
main.changeSelection(1);
}
}
@@ -47,7 +47,7 @@ class ChartDataScreen extends UISubstateWindow {
close();
}, 125);
add(saveButton);
closeButton = new UIButton(saveButton.x - 20, saveButton.y, "Close", function() {
close();
}, 125);
@@ -59,7 +59,7 @@ class ChartDataScreen extends UISubstateWindow {
public function saveInfo()
{
@:privateAccess scrollSpeedStepper.__onChange(scrollSpeedStepper.label.text);
PlayState.SONG.stage = stageTextBox.label.text;
PlayState.SONG.scrollSpeed = scrollSpeedStepper.value;
}
+27 -23
View File
@@ -348,7 +348,7 @@ class Charter extends UIState {
sectionSeparator.y = -2;
sectionSeparator.visible = Options.charterShowSections;
beatSeparator = new FlxBackdrop(null, Y, 0, 0);
beatSeparator.x = -10;
beatSeparator.x = -10;
beatSeparator.y = -1;
sectionSeparator.visible = Options.charterShowBeats;
for(sep in [sectionSeparator, beatSeparator]) {
@@ -414,7 +414,7 @@ class Charter extends UIState {
strumlineAddButton.cameras = [charterCamera];
strumlineInfoBG.cameras = [charterCamera];
strumLines.cameras = [charterCamera];
addEventSpr = new CharterEventAdd();
addEventSpr.alpha = 0;
addEventSpr.cameras = [charterCamera];
@@ -496,9 +496,10 @@ class Charter extends UIState {
public function refreshBPMSensitive() {
// refreshes everything dependant on BPM, and BPM changes
scrollBar.length = Conductor.getStepForTime(FlxG.sound.music.getDefault(vocals).length);
var length = FlxG.sound.music.getDefault(vocals).length;
scrollBar.length = Conductor.getStepForTime(length);
bottomLimit.y = Conductor.getStepForTime(FlxG.sound.music.getDefault(vocals).length) * 40;
bottomLimit.y = Conductor.getStepForTime(length) * 40;
bottomSeparator.y = bottomLimit.y-2;
}
@@ -522,7 +523,7 @@ class Charter extends UIState {
cast(group, FlxTypedGroup<Dynamic>).forEach(function(n) {
n.selected = false;
if (n.hovered && gridActionType == NONE) {
if (FlxG.mouse.justReleased) {
if (FlxG.mouse.justReleased) {
if (FlxG.keys.pressed.CONTROL)
selection.push(cast n);
else if (FlxG.keys.pressed.SHIFT)
@@ -559,18 +560,18 @@ class Charter extends UIState {
selectionBox.bHeight = Std.int(Math.abs(mousePos.y - dragStartPos.y));
} else {
if (FlxG.keys.pressed.SHIFT) {
for (group in [notesGroup, eventsGroup])
for (group in [notesGroup, eventsGroup])
for(n in cast(group, FlxTypedGroup<Dynamic>))
if (n.handleSelection(selectionBox) && selection.contains(n))
selection.remove(n);
} else if (FlxG.keys.pressed.CONTROL) {
for (group in [notesGroup, eventsGroup])
for (group in [notesGroup, eventsGroup])
for(n in cast(group, FlxTypedGroup<Dynamic>))
if (n.handleSelection(selectionBox) && !selection.contains(n))
selection.push(n);
} else {
selection = [];
for (group in [notesGroup, eventsGroup])
for (group in [notesGroup, eventsGroup])
for(n in cast(group, FlxTypedGroup<Dynamic>))
if (n.handleSelection(selectionBox))
selection.push(n);
@@ -612,7 +613,7 @@ class Charter extends UIState {
currentCursor = ARROW;
}
case NONE:
if (FlxG.mouse.justPressed)
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
@@ -761,10 +762,12 @@ class Charter extends UIState {
note.updatePos(note.step, note.id + 4, note.susLength, note.type);
}
var noteOffset = (strumLines.members.indexOf(cStr)) * 4;
for(note in strL.notes) {
var n = new CharterNote();
var t = Conductor.getStepForTime(note.time);
n.updatePos(t, ((strumLines.members.indexOf(cStr)) * 4) + note.id, Conductor.getStepForTime(note.time + note.sLen) - t, note.type);
n.updatePos(t, noteOffset + note.id, Conductor.getStepForTime(note.time + note.sLen) - t, note.type);
notesGroup.add(n);
}
sortNotes();
@@ -786,9 +789,9 @@ class Charter extends UIState {
while(i < notesGroup.members.length) {
var note = notesGroup.members[i];
if (Std.int(note.id / 4) == strumLineID) { // thanks neo lol!!!!!
deletedstrumNotes.push(note);
deletedstrumNotes.push(note);
deleteSingleSelection(note, false);
} else
} else
i++;
}
@@ -803,7 +806,7 @@ class Charter extends UIState {
if (addToUndo) {
var newStrL = Reflect.copy(strL);
newStrL.notes.clear();
for (note in deletedstrumNotes) {
var time = Conductor.getTimeForStep(note.step);
newStrL.notes.push({
@@ -843,7 +846,7 @@ class Charter extends UIState {
}
public inline function removeStrumlineFromSelection(strumLineID:Int) {
var i = 0;
var i = 0;
while(i < selection.length) {
if (selection[i] is CharterNote) {
var note = cast (selection[i], CharterNote);
@@ -908,14 +911,15 @@ class Charter extends UIState {
}
}
Conductor.songPosition = FlxMath.bound(Conductor.songPosition, 0, FlxG.sound.music.getDefault(vocals).length);
var songLength = FlxG.sound.music.getDefault(vocals).length;
Conductor.songPosition = FlxMath.bound(Conductor.songPosition, 0, songLength);
if (Conductor.songPosition >= FlxG.sound.music.getDefault(vocals).length) {
if (Conductor.songPosition >= songLength) {
FlxG.sound.music.pause();
vocals.pause();
}
songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(FlxG.sound.music.length)}'
songPosInfo.text = '${CoolUtil.timeToStr(Conductor.songPosition)} / ${CoolUtil.timeToStr(songLength)}'
+ '\nStep: ${curStep}'
+ '\nBeat: ${curBeat}'
+ '\nMeasure: ${curMeasure}'
@@ -1013,7 +1017,7 @@ class Charter extends UIState {
var metaDiffPath = Paths.file('songs/${__song.toLowerCase()}/meta-${__diff.toLowerCase()}.json');
sys.io.File.saveContent(
Assets.getPath(Assets.exists(metaDiffPath) ? metaDiffPath : metaPath),
Assets.getPath(Assets.exists(metaDiffPath) ? metaDiffPath : metaPath),
Json.stringify(PlayState.SONG.meta == null ? {} : PlayState.SONG.meta, null, "\t")
);
return;
@@ -1036,8 +1040,8 @@ class Charter extends UIState {
function _edit_copy(_) {
if(selection.length == 0) return;
var minStep:Float = selection[0].step;
var minStep:Float = selection[0].step;
for(s in selection)
if (s.step < minStep) minStep = s.step;
@@ -1101,7 +1105,7 @@ class Charter extends UIState {
case CDeleteSelection(selection):
createSelection(selection, false);
case CSelectionDrag(selection, change):
for (s in selection)
for (s in selection)
if (s.draggable) s.handleDrag(change * -1);
this.selection = selection;
case CEditSustains(changes):
@@ -1144,7 +1148,7 @@ class Charter extends UIState {
case CDeleteSelection(selection):
deleteSelection(selection, false);
case CSelectionDrag(selection, change):
for (s in selection)
for (s in selection)
if (s.draggable) s.handleDrag(change);
this.selection = selection;
case CEditSustains(changes):
@@ -1176,7 +1180,7 @@ class Charter extends UIState {
FlxG.state.openSubState(new ChartDataScreen(PlayState.SONG));
function chart_edit_metadata(_)
FlxG.state.openSubState(new MetaDataScreen(PlayState.SONG.meta));
function _playback_metronome(t) {
t.icon = (Options.charterMetronomeEnabled = !Options.charterMetronomeEnabled) ? 1 : 0;
}
@@ -8,10 +8,10 @@ class CharterBackdrop extends FlxBackdrop {
public function new() {
super(null, Y, 0, 0);
makeGraphic(160, 160, 0xFF272727, true);
pixels.lock();
// Checkerboard
for(y in 0...4)
for(x in 0...2)
@@ -20,7 +20,7 @@ class CharterEventScreen extends UISubstateWindow {
public var paramsPanel:FlxGroup;
public var paramsFields:Array<FlxBasic> = [];
public var saveButton:UIButton;
public var closeButton:UIButton;
@@ -66,7 +66,7 @@ class CharterEventScreen extends UISubstateWindow {
saveCurTab();
chartEvent.refreshEventIcons();
if (events.length <= 0 && !creatingEvent)
if (events.length <= 0 && !creatingEvent)
Charter.instance.deleteSelection([chartEvent]);
else if (events.length > 0) {
var oldEvents:Array<ChartEvent> = chartEvent.events.copy();
@@ -75,7 +75,7 @@ class CharterEventScreen extends UISubstateWindow {
];
if (creatingEvent && events.length > 0)
Charter.instance.createSelection([chartEvent]);
Charter.instance.createSelection([chartEvent]);
else {
chartEvent.events = [
for (i in eventsList.buttons.members) i.event
@@ -241,7 +241,7 @@ class EventButton extends UIButton {
members.push(deleteButton);
deleteIcon = new FlxSprite(deleteButton.x + (15/2), deleteButton.y + 4).loadGraphic(Paths.image('editors/character/delete-button'));
deleteIcon.antialiasing = false;
members.push(deleteIcon);
}
@@ -43,7 +43,34 @@ class CharterSelection extends EditorTreeMenu {
override function createPost() {
super.createPost();
var idk:OptionsScreen = optionsTree.members.last();
if (idk.members.length > 0) idk.changeSelection(1);
main.changeSelection(1);
}
public override function update(elapsed:Float) {
super.update(elapsed);
bg.colorTransform.redOffset = lerp(bg.colorTransform.redOffset, 0, 0.0625);
bg.colorTransform.greenOffset = lerp(bg.colorTransform.greenOffset, 0, 0.0625);
bg.colorTransform.blueOffset = lerp(bg.colorTransform.blueOffset, 0, 0.0625);
bg.colorTransform.redMultiplier = lerp(bg.colorTransform.redMultiplier, 1, 0.0625);
bg.colorTransform.greenMultiplier = lerp(bg.colorTransform.greenMultiplier, 1, 0.0625);
bg.colorTransform.blueMultiplier = lerp(bg.colorTransform.blueMultiplier, 1, 0.0625);
}
public override function onMenuChange() {
super.onMenuChange();
if (optionsTree.members.length > 1) { // selected a song
// small flashbang
if(freeplayList.songs.length <= main.curSelected-1) return;
var color:FlxColor = freeplayList.songs[main.curSelected-1].parsedColor.getDefault(0xFFFFFFFF);
bg.colorTransform.redOffset = 0.25 * color.red;
bg.colorTransform.greenOffset = 0.25 * color.green;
bg.colorTransform.blueOffset = 0.25 * color.blue;
bg.colorTransform.redMultiplier = FlxMath.lerp(1, color.redFloat, 0.25);
bg.colorTransform.greenMultiplier = FlxMath.lerp(1, color.greenFloat, 0.25);
bg.colorTransform.blueMultiplier = FlxMath.lerp(1, color.blueFloat, 0.25);
}
}
}
@@ -99,7 +99,7 @@ class CharterStrumlineButton extends UITopMenuButton {
}
},
{
label: "Delete",
label: "Delete",
onSelect: function (_) {
Charter.instance.deleteStrumlineFromData(strLine.strumLine);
}
@@ -13,12 +13,13 @@ class CharterStrumlineExtraButton extends UISprite {
scrollFactor.set(1, 0);
alpha = 0;
button = new UISprite();
button.loadGraphic(Paths.image(imagePath));
button.scale.set(0.75,0.75);
button.updateHitbox();
button.antialiasing = false;
button.cursor = BUTTON;
members.push(button);
this.text = new UIText(0,0, 160, text);
@@ -49,4 +50,10 @@ class CharterStrumlineExtraButton extends UISprite {
FlxMath.lerp(button.scale.y, buttonScale.y, 1/6)
);
}
public override function destroy() {
super.destroy();
buttonScale.put();
}
}
@@ -60,10 +60,10 @@ class CharterStrumlineScreen extends UISubstateWindow {
add(title = new UIText(windowSpr.x + 20, windowSpr.y + 30 + 16, 0, creatingStrumLine ? "Create New Strumline" : "Edit Strumline Properties", 28));
charactersList = new UIButtonList<CharacterButton>(15, title.y + title.height + 36, 250, 259, "", FlxPoint.get(250, 54), null, 0);
charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0,0,"New Char", charactersList));
charactersList.addButton.callback = () -> charactersList.add(new CharacterButton(0, 0, "New Char", charactersList));
charactersList.cameraSpacing = 0;
for (i in strumLine.characters)
charactersList.add(new CharacterButton(0,0,i, charactersList));
for (i in strumLine.characters)
charactersList.add(new CharacterButton(0, 0, i, charactersList));
add(charactersList);
addLabelOn(charactersList, "Characters");
@@ -176,7 +176,11 @@ class CharacterButton extends UIButton {
members.push(textBox = new UITextBox(charIcon.x + charIcon.width + 16, bHeight/2 - (32/2), char, 115));
textBox.antialiasing = true;
textBox.onChange = function(char:String) {
charIcon.loadGraphic(Assets.exists(Paths.image("icons/" + char)) ? Paths.image("icons/" + char) : Paths.image("icons/face"), true, 150, 150);
char = Character.getIconFromCharName(char);
var image = Paths.image("icons/" + char);
if(!Assets.exists(image))
image = Paths.image("icons/face");
charIcon.loadGraphic(image, true, 150, 150);
charIcon.updateHitbox();
}
@@ -185,7 +189,7 @@ class CharacterButton extends UIButton {
}, 32);
deleteButton.color = 0xFFFF0000;
members.push(deleteButton);
deleteIcon = new FlxSprite(deleteButton.x + (15/2), deleteButton.y + 8).loadGraphic(Paths.image('editors/character/delete-button'));
deleteIcon.antialiasing = false;
members.push(deleteIcon);
@@ -201,5 +205,5 @@ class CharacterButton extends UIButton {
deleteButton.shouldPress = shouldPress;
super.update(elapsed);
}
}
}
@@ -27,7 +27,6 @@ class CharterWaveForms extends FlxTypedGroup<WaveformSprite> {
Conductor.getTimeForStep((measure+1) * Conductor.getMeasureLength())
);
add(waveFormMeasure);
}
}
@@ -78,7 +77,7 @@ class WaveformSprite extends FlxSprite {
startPos -= startPos % buffer.bitsPerSample;
endPos -= endPos % buffer.bitsPerSample;
pixels.lock();
pixels.fillRect(new Rectangle(0, 0, pixels.width, pixels.height), 0);
pixels.fillRect(new Rectangle(0, 0, pixels.width, pixels.height), 0);
var diff = endPos - startPos;
var diffRange = Math.floor(diff / pixels.height);
for(y in 0...pixels.height) {
@@ -44,10 +44,10 @@ class SongCreationScreen extends UISubstateWindow {
super();
if (onSave != null) this.onSave = onSave;
}
public override function create() {
winTitle = "Creating New Song";
winWidth = 748 - 32 + 40;
winHeight = 520;
@@ -175,7 +175,7 @@ class SongCreationScreen extends UISubstateWindow {
windowSpr.bWidth = Std.int(pageSizes[curPage].x);
windowSpr.bHeight = Std.int(pageSizes[curPage].y);
titleSpr.x = windowSpr.x + 25;
titleSpr.x = windowSpr.x + 25;
titleSpr.y = windowSpr.y + ((30 - titleSpr.height) / 2);
saveButton.field.text = curPage == pages.length-1 ? "Save & Close" : 'Next (${curPage+1+1}/${pages.length}) >';
+1
View File
@@ -7,4 +7,5 @@ interface IUIFocusable {
public function onKeyDown(e:KeyCode, modifier:KeyModifier):Void;
public function onKeyUp(e:KeyCode, modifier:KeyModifier):Void;
public function onTextInput(text:String):Void;
public function onTextEdit(text:String, start:Int, end:Int):Void;
}
+3 -2
View File
@@ -110,7 +110,7 @@ class UIButtonList<T:UIButton> extends UIWindow {
nextscrollY -= Math.min((bHeight - 100) - FlxG.mouse.getWorldPosition(buttonCameras).y, 0) / 8;
nextscrollY += Math.min(FlxG.mouse.getWorldPosition(buttonCameras).y - 100, 0) / 8;
}
buttonCameras.scroll.y = nextscrollY;
for (button in buttons) {
@@ -131,7 +131,8 @@ class UIButtonList<T:UIButton> extends UIWindow {
super.destroy();
if(buttonCameras != null) {
FlxG.cameras.remove(buttonCameras);
if (FlxG.cameras.list.contains(buttonCameras))
FlxG.cameras.remove(buttonCameras);
buttonCameras = null;
}
}
+2 -1
View File
@@ -17,6 +17,8 @@ class UIDropDown extends UISliceSprite {
this.options = options;
this.index = index;
cursor = BUTTON;
label = new UIText(0, 0, width - height, options[index]);
members.push(label);
@@ -33,7 +35,6 @@ class UIDropDown extends UISliceSprite {
}
public override function update(elapsed:Float) {
var opened = curMenu.contextMenuOpened();
framesOffset = (opened || (hovered && FlxG.mouse.pressed)) ? 18 : (hovered ? 9 : 0);
if (FlxG.mouse.justReleased && (hovered || dropButton.hovered)) {
+1
View File
@@ -24,6 +24,7 @@ class UIScrollBar extends UISprite {
this.length = length;
thumb = new UISliceSprite(0, 0, w, h, 'editors/ui/scrollbar');
thumb.cursor = BUTTON;
members.push(thumb);
thumbIcon = new FlxSprite(0, 0, Paths.image('editors/ui/scrollbar-icon'));
+6
View File
@@ -37,6 +37,7 @@ class UIState extends MusicBeatState {
FlxG.stage.window.onKeyDown.add(onKeyDown);
FlxG.stage.window.onKeyUp.add(onKeyUp);
FlxG.stage.window.onTextInput.add(onTextInput);
FlxG.stage.window.onTextEdit.add(onTextEdit);
}
private function onKeyDown(e:KeyCode, modifier:KeyModifier) {
@@ -53,6 +54,10 @@ class UIState extends MusicBeatState {
if (currentFocus != null)
currentFocus.onTextInput(str);
}
private function onTextEdit(str:String, start:Int, end:Int) {
if (currentFocus != null)
currentFocus.onTextEdit(str, start, end);
}
public function updateButtonHandler(spr:UISprite, buttonHandler:Void->Void) {
spr.__rect.x = spr.x;
@@ -119,6 +124,7 @@ class UIState extends MusicBeatState {
FlxG.stage.window.onKeyDown.remove(onKeyDown);
FlxG.stage.window.onKeyUp.remove(onKeyUp);
FlxG.stage.window.onTextInput.remove(onTextInput);
FlxG.stage.window.onTextEdit.remove(onTextEdit);
}
public function closeCurrentContextMenu() {
+6
View File
@@ -137,4 +137,10 @@ class UITextBox extends UISliceSprite implements IUIFocusable {
label.text = label.text.substr(0, position) + text + label.text.substr(position);
position += text.length;
}
// untested, but this should be a fix for if the text wont type
public function onTextEdit(text:String, start:Int, end:Int):Void {
trace(text, start, end);
label.text = label.text.substr(0, position) + text + label.text.substr(position);
position += text.length;
}
}
+1 -1
View File
@@ -5,7 +5,7 @@ class UIWindow extends UISliceSprite {
public override function new(x:Float, y:Float, w:Int, h:Int, title:String) {
super(x, y, w, h, "editors/ui/warning-popup");
members.push(titleSpr = new UIText(x + 25, y, bWidth - 50, title, 15, -1));
titleSpr.y = y + ((30 - titleSpr.height) / 2);
}
+1
View File
@@ -126,6 +126,7 @@ class FreeplayState extends MusicBeatState
bg = new FlxSprite(0, 0).loadAnimatedGraphic(Paths.image('menus/menuDesat'));
if (songs.length > 0)
bg.color = songs[0].color;
bg.antialiasing = true;
add(bg);
grpSongs = new FlxTypedGroup<Alphabet>();
+5 -5
View File
@@ -1,5 +1,6 @@
package funkin.menus;
import funkin.backend.scripting.events.MenuChangeEvent;
import funkin.options.OptionsMenu;
import funkin.backend.scripting.events.PauseCreationEvent;
import funkin.backend.scripting.events.NameEvent;
@@ -170,12 +171,11 @@ class PauseSubState extends MusicBeatSubstate
function changeSelection(change:Int = 0):Void
{
curSelected += change;
var event = EventManager.get(MenuChangeEvent).recycle(curSelected, FlxMath.wrap(curSelected + change, 0, menuItems.length-1), change, change != 0);
pauseScript.call("onChangeItem", [event]);
if (event.cancelled) return;
if (curSelected < 0)
curSelected = menuItems.length - 1;
if (curSelected >= menuItems.length)
curSelected = 0;
curSelected = event.value;
var bullShit:Int = 0;