diff --git a/source/funkin/editors/DebugOptions.hx b/source/funkin/editors/DebugOptions.hx index b704feac..3dc44b22 100644 --- a/source/funkin/editors/DebugOptions.hx +++ b/source/funkin/editors/DebugOptions.hx @@ -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(); diff --git a/source/funkin/editors/character/CharacterAnimButtons.hx b/source/funkin/editors/character/CharacterAnimButtons.hx index e19c00b5..d4b9c858 100644 --- a/source/funkin/editors/character/CharacterAnimButtons.hx +++ b/source/funkin/editors/character/CharacterAnimButtons.hx @@ -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); diff --git a/source/funkin/editors/character/CharacterAnimScreen.hx b/source/funkin/editors/character/CharacterAnimScreen.hx index d21d5433..1b64907f 100644 --- a/source/funkin/editors/character/CharacterAnimScreen.hx +++ b/source/funkin/editors/character/CharacterAnimScreen.hx @@ -117,7 +117,7 @@ class CharacterAnimScreen extends UISubstateWindow { if (i != null) animData.indices.push(i); } - + if (onSave != null) onSave(animData); } } \ No newline at end of file diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index accea2c9..e7b8f8af 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -33,7 +33,7 @@ class CharacterEditor extends UIState { // WINDOWS public var characterPropertiresWindow:CharacterPropertiesWindow; public var characterAnimsWindow:UIButtonList; - + // 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); } diff --git a/source/funkin/editors/character/CharacterGhostsHandler.hx b/source/funkin/editors/character/CharacterGhostsHandler.hx index b9d3a2cb..62a44c9f 100644 --- a/source/funkin/editors/character/CharacterGhostsHandler.hx +++ b/source/funkin/editors/character/CharacterGhostsHandler.hx @@ -12,7 +12,7 @@ class CharacterGhostsHandler extends FlxTypedGroup { this.character = character; super(); - for (anim in character.getNameList()) + for (anim in character.getNameList()) createGhost(anim); } @@ -21,7 +21,7 @@ class CharacterGhostsHandler extends FlxTypedGroup { 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 { } inline function rePositionGhosts() { - for (ghost in animGhosts) + for (ghost in animGhosts) ghost.frameOffset.set(ghost.getAnimOffset(ghost.getAnimName()).x, ghost.getAnimOffset(ghost.getAnimName()).y); } } \ No newline at end of file diff --git a/source/funkin/editors/charter/ChartDataScreen.hx b/source/funkin/editors/charter/ChartDataScreen.hx index 19d100e3..846fd4bc 100644 --- a/source/funkin/editors/charter/ChartDataScreen.hx +++ b/source/funkin/editors/charter/ChartDataScreen.hx @@ -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; } diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 3efda629..90c7c1b7 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -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]; @@ -522,7 +522,7 @@ class Charter extends UIState { cast(group, FlxTypedGroup).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 +559,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)) 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)) 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)) if (n.handleSelection(selectionBox)) selection.push(n); @@ -612,7 +612,7 @@ class Charter extends UIState { currentCursor = ARROW; } - + case NONE: if (FlxG.mouse.justPressed) FlxG.mouse.getWorldPosition(charterCamera, dragStartPos); @@ -786,9 +786,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 +803,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 +843,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); @@ -1013,7 +1013,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 +1036,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 +1101,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 +1144,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 +1176,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; } diff --git a/source/funkin/editors/charter/CharterBackdrop.hx b/source/funkin/editors/charter/CharterBackdrop.hx index d14104d2..b5b0a747 100644 --- a/source/funkin/editors/charter/CharterBackdrop.hx +++ b/source/funkin/editors/charter/CharterBackdrop.hx @@ -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) diff --git a/source/funkin/editors/charter/CharterEventScreen.hx b/source/funkin/editors/charter/CharterEventScreen.hx index 31b6e581..e1e4eb25 100644 --- a/source/funkin/editors/charter/CharterEventScreen.hx +++ b/source/funkin/editors/charter/CharterEventScreen.hx @@ -20,7 +20,7 @@ class CharterEventScreen extends UISubstateWindow { public var paramsPanel:FlxGroup; public var paramsFields:Array = []; - + 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.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); } diff --git a/source/funkin/editors/charter/CharterStrumline.hx b/source/funkin/editors/charter/CharterStrumline.hx index e2b746a9..14f4d671 100644 --- a/source/funkin/editors/charter/CharterStrumline.hx +++ b/source/funkin/editors/charter/CharterStrumline.hx @@ -99,7 +99,7 @@ class CharterStrumlineButton extends UITopMenuButton { } }, { - label: "Delete", + label: "Delete", onSelect: function (_) { Charter.instance.deleteStrumlineFromData(strLine.strumLine); } diff --git a/source/funkin/editors/charter/CharterStrumlineExtraButton.hx b/source/funkin/editors/charter/CharterStrumlineExtraButton.hx index b1fc7ad3..4aa9fe89 100644 --- a/source/funkin/editors/charter/CharterStrumlineExtraButton.hx +++ b/source/funkin/editors/charter/CharterStrumlineExtraButton.hx @@ -13,7 +13,7 @@ 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); diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index 41b3a301..9bbf339f 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -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(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); - } + } } \ No newline at end of file diff --git a/source/funkin/editors/charter/CharterWaveForms.hx b/source/funkin/editors/charter/CharterWaveForms.hx index 2691f896..6ad2a549 100644 --- a/source/funkin/editors/charter/CharterWaveForms.hx +++ b/source/funkin/editors/charter/CharterWaveForms.hx @@ -27,7 +27,6 @@ class CharterWaveForms extends FlxTypedGroup { 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) { diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index d6967892..98a3e6ce 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -42,10 +42,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; @@ -157,7 +157,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}) >'; diff --git a/source/funkin/editors/ui/IUIFocusable.hx b/source/funkin/editors/ui/IUIFocusable.hx index 2f67c6af..b2285a76 100644 --- a/source/funkin/editors/ui/IUIFocusable.hx +++ b/source/funkin/editors/ui/IUIFocusable.hx @@ -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; } \ No newline at end of file diff --git a/source/funkin/editors/ui/UIButtonList.hx b/source/funkin/editors/ui/UIButtonList.hx index 5e861eec..c8fa79bd 100644 --- a/source/funkin/editors/ui/UIButtonList.hx +++ b/source/funkin/editors/ui/UIButtonList.hx @@ -110,7 +110,7 @@ class UIButtonList 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) { diff --git a/source/funkin/editors/ui/UIState.hx b/source/funkin/editors/ui/UIState.hx index 01d330c5..716e277d 100644 --- a/source/funkin/editors/ui/UIState.hx +++ b/source/funkin/editors/ui/UIState.hx @@ -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() { diff --git a/source/funkin/editors/ui/UITextBox.hx b/source/funkin/editors/ui/UITextBox.hx index ff86709f..443fd890 100644 --- a/source/funkin/editors/ui/UITextBox.hx +++ b/source/funkin/editors/ui/UITextBox.hx @@ -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; + } } \ No newline at end of file diff --git a/source/funkin/editors/ui/UIWindow.hx b/source/funkin/editors/ui/UIWindow.hx index 2346d995..89fd6bfe 100644 --- a/source/funkin/editors/ui/UIWindow.hx +++ b/source/funkin/editors/ui/UIWindow.hx @@ -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); } diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 83f0ddec..195466b7 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -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();