diff --git a/art/flashFiles/RECOVER_teaser animated.fla b/art/flashFiles/RECOVER_teaser animated.fla deleted file mode 100644 index a96f8195..00000000 Binary files a/art/flashFiles/RECOVER_teaser animated.fla and /dev/null differ diff --git a/assets/images/desktop/cursor.png b/assets/images/desktop/cursor.png deleted file mode 100644 index 178f0e42..00000000 Binary files a/assets/images/desktop/cursor.png and /dev/null differ diff --git a/assets/images/desktop/icons/command.png b/assets/images/desktop/icons/command.png deleted file mode 100644 index 6686a2e6..00000000 Binary files a/assets/images/desktop/icons/command.png and /dev/null differ diff --git a/assets/images/desktop/ui.xml b/assets/images/desktop/ui.xml deleted file mode 100644 index 8473c099..00000000 --- a/assets/images/desktop/ui.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/images/desktop/ui/button.png b/assets/images/desktop/ui/button.png deleted file mode 100644 index a4013c75..00000000 Binary files a/assets/images/desktop/ui/button.png and /dev/null differ diff --git a/assets/images/desktop/ui/buttonDisabled.png b/assets/images/desktop/ui/buttonDisabled.png deleted file mode 100644 index ac9679dd..00000000 Binary files a/assets/images/desktop/ui/buttonDisabled.png and /dev/null differ diff --git a/assets/images/desktop/ui/buttonHover.png b/assets/images/desktop/ui/buttonHover.png deleted file mode 100644 index eb5a668e..00000000 Binary files a/assets/images/desktop/ui/buttonHover.png and /dev/null differ diff --git a/assets/images/desktop/ui/buttonPressed.png b/assets/images/desktop/ui/buttonPressed.png deleted file mode 100644 index 9a9a7bf6..00000000 Binary files a/assets/images/desktop/ui/buttonPressed.png and /dev/null differ diff --git a/assets/images/desktop/ui/caption.png b/assets/images/desktop/ui/caption.png deleted file mode 100644 index d102d64b..00000000 Binary files a/assets/images/desktop/ui/caption.png and /dev/null differ diff --git a/assets/images/desktop/ui/captionButtons.png b/assets/images/desktop/ui/captionButtons.png deleted file mode 100644 index f689dfcc..00000000 Binary files a/assets/images/desktop/ui/captionButtons.png and /dev/null differ diff --git a/assets/images/desktop/ui/captionInactive.png b/assets/images/desktop/ui/captionInactive.png deleted file mode 100644 index f65197b4..00000000 Binary files a/assets/images/desktop/ui/captionInactive.png and /dev/null differ diff --git a/assets/images/desktop/ui/checkbox.png b/assets/images/desktop/ui/checkbox.png deleted file mode 100644 index cd4bd016..00000000 Binary files a/assets/images/desktop/ui/checkbox.png and /dev/null differ diff --git a/assets/images/desktop/ui/context.png b/assets/images/desktop/ui/context.png deleted file mode 100644 index 0991f2c4..00000000 Binary files a/assets/images/desktop/ui/context.png and /dev/null differ diff --git a/assets/images/desktop/ui/contextOption.png b/assets/images/desktop/ui/contextOption.png deleted file mode 100644 index 51864d45..00000000 Binary files a/assets/images/desktop/ui/contextOption.png and /dev/null differ diff --git a/assets/images/desktop/ui/menuBar.png b/assets/images/desktop/ui/menuBar.png deleted file mode 100644 index 7e33f323..00000000 Binary files a/assets/images/desktop/ui/menuBar.png and /dev/null differ diff --git a/assets/images/desktop/ui/tab.png b/assets/images/desktop/ui/tab.png deleted file mode 100644 index 05af22d4..00000000 Binary files a/assets/images/desktop/ui/tab.png and /dev/null differ diff --git a/assets/images/desktop/ui/tabBody.png b/assets/images/desktop/ui/tabBody.png deleted file mode 100644 index ced1caa0..00000000 Binary files a/assets/images/desktop/ui/tabBody.png and /dev/null differ diff --git a/assets/images/desktop/ui/tabHover.png b/assets/images/desktop/ui/tabHover.png deleted file mode 100644 index a5591628..00000000 Binary files a/assets/images/desktop/ui/tabHover.png and /dev/null differ diff --git a/assets/images/desktop/ui/tabNonSelected.png b/assets/images/desktop/ui/tabNonSelected.png deleted file mode 100644 index b644b3f5..00000000 Binary files a/assets/images/desktop/ui/tabNonSelected.png and /dev/null differ diff --git a/assets/images/desktop/ui/tabPressed.png b/assets/images/desktop/ui/tabPressed.png deleted file mode 100644 index 707ebfff..00000000 Binary files a/assets/images/desktop/ui/tabPressed.png and /dev/null differ diff --git a/assets/images/desktop/ui/taskbar.png b/assets/images/desktop/ui/taskbar.png deleted file mode 100644 index 8d67514c..00000000 Binary files a/assets/images/desktop/ui/taskbar.png and /dev/null differ diff --git a/assets/images/desktop/ui/textbox.png b/assets/images/desktop/ui/textbox.png deleted file mode 100644 index affdf708..00000000 Binary files a/assets/images/desktop/ui/textbox.png and /dev/null differ diff --git a/assets/images/desktop/ui/textboxFocus.png b/assets/images/desktop/ui/textboxFocus.png deleted file mode 100644 index 4592db0d..00000000 Binary files a/assets/images/desktop/ui/textboxFocus.png and /dev/null differ diff --git a/assets/images/desktop/ui/textboxHover.png b/assets/images/desktop/ui/textboxHover.png deleted file mode 100644 index 49688263..00000000 Binary files a/assets/images/desktop/ui/textboxHover.png and /dev/null differ diff --git a/assets/images/desktop/ui/textboxPressed.png b/assets/images/desktop/ui/textboxPressed.png deleted file mode 100644 index 21f51250..00000000 Binary files a/assets/images/desktop/ui/textboxPressed.png and /dev/null differ diff --git a/assets/images/editors/ui/checkbox.png b/assets/images/editors/ui/checkbox.png new file mode 100644 index 00000000..416c76fd Binary files /dev/null and b/assets/images/editors/ui/checkbox.png differ diff --git a/buildnumber.txt b/buildnumber.txt index 5b18ee08..09397688 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -2492 \ No newline at end of file +2495 \ No newline at end of file diff --git a/source/funkin/desktop/DesktopMain.hx b/source/funkin/desktop/DesktopMain.hx deleted file mode 100644 index 38c429d6..00000000 --- a/source/funkin/desktop/DesktopMain.hx +++ /dev/null @@ -1,222 +0,0 @@ -package funkin.desktop; - -import flixel.math.FlxRect; -import openfl.geom.Rectangle; -import lime.app.Application; -import openfl.display.BitmapData; -import flixel.system.scaleModes.BaseScaleMode; -import flixel.system.scaleModes.FixedScaleAdjustSizeScaleMode; -import flixel.math.FlxPoint; -import flixel.util.FlxDestroyUtil; -import funkin.desktop.editors.*; -import funkin.desktop.windows.*; -import funkin.desktop.theme.Theme; - -class DesktopMain extends MusicBeatState { - public var oldScaleMode:BaseScaleMode; - public var wallpaper:FlxSprite; - public var screenSize:FlxPoint; - - public var windows:WindowGroup; - - public static var instance:DesktopMain; - - public static var currentFocus:IDesktopFocusableObject; - - public static var mouseInput:MouseInput; - - public static var theme:Theme = null; - - public static var contextMenu:ContextMenu = null; - - public static function init() { - theme = Theme.loadFromAssets(Paths.getPath('images/desktop/ui.xml', TEXT, null)); - mouseInput = new MouseInput(); - - FlxG.signals.preUpdate.add(function() { - updateMouseInput(); - }); - } - - public override function create() { - super.create(); - - instance = this; - - FlxG.mouse.useSystemCursor = FlxG.mouse.visible = true; - oldScaleMode = FlxG.scaleMode; - FlxG.scaleMode = new FixedScaleAdjustSizeScaleMode(false, false); - - wallpaper = new FlxSprite(); - #if windows - try { - wallpaper.loadGraphic(BitmapData.fromFile('${Sys.getEnv("AppData")}\\Microsoft\\Windows\\Themes\\TranscodedWallpaper')); - } catch(e) #end wallpaper.loadGraphic(Paths.image("menus/menuBG")); - wallpaper.scrollFactor.set(0, 0); // anchor at top left - wallpaper.antialiasing = true; - add(wallpaper); - - screenSize = new FlxPoint(-1, -1); - - windows = new WindowGroup(); - add(windows); - } - - private static function updateMouseInput() { - mouseInput.set(FlxG.mouse.pressed, FlxG.mouse.justPressed, FlxG.mouse.justReleased, FlxG.mouse.pressedRight, FlxG.mouse.justPressedRight, FlxG.mouse.justReleasedRight); - } - - public override function update(elapsed:Float) { - updateMouseInput(); - - if (contextMenu != null) - contextMenu.update(elapsed); - - super.update(elapsed); - - - if (screenSize.x != FlxG.width || screenSize.y != FlxG.height) { - screenSize.set(FlxG.width, FlxG.height); - updateScreenRes(); - } - - // debug window - if (FlxG.keys.justPressed.SPACE) - windows.add(new Window(new HelloWorld())); - if (FlxG.keys.justPressed.F1) - windows.add(new Window(new CharacterEditor('dad'))); - if (FlxG.keys.justPressed.F2) - windows.add(new Window(new EditorPlayState())); - - FlxG.sound.enableVolumeChanges = !(currentFocus is IDesktopInputObject); - - // TEMPORARY ESCAPE KEY UNTIL TASKBAR IS ADDED - if (FlxG.keys.justPressed.ESCAPE) FlxG.switchState(new funkin.menus.MainMenuState()); - } - - public function openWindow(content:WindowContent) { - return windows.add(new Window(content)); - } - - public override function draw() { - super.draw(); - if (contextMenu != null) - contextMenu.draw(); - } - - public function updateScreenRes() { - // update wallpaper - wallpaper.setUnstretchedGraphicSize(FlxG.width, FlxG.height); - for(e in windows) { - e.onDesktopSizeChange(FlxG.width, FlxG.height); - } - } - - public override function destroy() { - super.destroy(); - - FlxG.sound.enableVolumeChanges = true; - contextMenu = FlxDestroyUtil.destroy(contextMenu); - - FlxG.scaleMode = oldScaleMode; - FlxG.mouse.useSystemCursor = FlxG.mouse.visible = false; - - // TODO: switch back while using config - FlxG.resizeGame(1280, 720); - - if (screenSize != null) - screenSize.put(); - } - - public function focusWindow(window:Window) { - windows.remove(window, true); - windows.add(window); - layerCameras(); - } - - public function layerCameras() { - for(win in windows.members) { - FlxG.cameras.remove(win.windowCaptionCamera, false); - for(e in win.windowCameras) FlxG.cameras.remove(e.camera, false); - } - for(win in windows.members) { - FlxG.cameras.add(win.windowCaptionCamera, false); - for(e in win.windowCameras) FlxG.cameras.add(e.camera, false); - } - } - - public static function loseFocus(obj:IDesktopFocusableObject) { - if (currentFocus == obj) { - currentFocus.onFocusLost(); - currentFocus = null; - } - } - - public static function setFocus(obj:IDesktopFocusableObject) { - if (currentFocus == obj) return; - if (currentFocus != null) - currentFocus.onFocusLost(); - (currentFocus = obj).onFocus(); - } - - public static function hasFocus(obj:IDesktopFocusableObject) { - return currentFocus == obj; - } -} - -class MouseInput { - public var pressed:Bool = false; - public var justPressed:Bool = false; - public var justReleased:Bool = false; - public var pressedRight:Bool = false; - public var justPressedRight:Bool = false; - public var justReleasedRight:Bool = false; - public var screenPos:FlxPoint = null; - private var __cancelled:Bool = false; - - public function cancel() { - pressed = justPressed = justReleased = pressedRight = justPressedRight = justReleasedRight = false; - __cancelled = true; - } - - public function new() {} - - public function set(pressed:Bool, justPressed:Bool, justReleased:Bool, pressedRight:Bool, justPressedRight:Bool, justReleasedRight:Bool) { - this.pressed = pressed; - this.justPressed = justPressed; - this.justReleased = justReleased; - this.pressedRight = pressedRight; - this.justPressedRight = justPressedRight; - this.justReleasedRight = justReleasedRight; - this.screenPos = FlxG.mouse.getScreenPosition(FlxG.camera); - this.__cancelled = false; - } - - public function overlaps(spr:FlxObject, ?camera:FlxCamera) { - return overlapsRect(spr, new FlxRect(spr.x, spr.y, spr.width, spr.height), camera); - // return FlxG.mouse.overlaps(spr, camera); - } - - public function overlapsRect(spr:FlxBasic, rect:FlxRect, ?camera:FlxCamera) { - if (__cancelled) return false; - if (camera == null) camera = FlxG.camera; - if (spr is FlxObject && camera != null) { - var obj = cast(spr, FlxObject); - rect.x -= camera.scroll.x * obj.scrollFactor.x; - rect.y -= camera.scroll.y * obj.scrollFactor.y; - } - var pos = FlxG.mouse.getScreenPosition(camera); - - return ((pos.x > rect.x) && (pos.x < rect.x + rect.width)) && ((pos.y > rect.y) && (pos.y < rect.y + rect.height)); - } -} - -interface IDesktopFocusableObject { - public function onFocus():Void; - public function onFocusLost():Void; -} - -// useless, only here for -interface IDesktopInputObject { - -} \ No newline at end of file diff --git a/source/funkin/desktop/DesktopScreen.hx b/source/funkin/desktop/DesktopScreen.hx deleted file mode 100644 index a94b1bf3..00000000 --- a/source/funkin/desktop/DesktopScreen.hx +++ /dev/null @@ -1,53 +0,0 @@ -package funkin.desktop; - -import flixel.util.FlxDestroyUtil.IFlxDestroyable; -import openfl.events.Event; -import lime.app.Application; -import lime.ui.Window; - -class DesktopScreen implements IFlxDestroyable { - public var cameras:Array = []; - public var window:Window; - - public function new() { - window = Application.current.createWindow({ - x: 0, - y: 0, - width: FlxG.width, - height: FlxG.height - }); - @:privateAccess - Application.current.__addWindow(window); - - window.stage.addEventListener(Event.ENTER_FRAME, onFrameEnter); - - FlxG.signals.preDraw.add(__onPreDraw); - FlxG.signals.postDraw.add(__onPostDraw); - - window.onClose.add(destroy); - } - - public function addCamera(cam:FlxCamera) { - cameras.push(cam); - window.stage.addChild(cam.flashSprite); - } - - private inline function __onPreDraw() {} - private inline function __onPostDraw() {} - - private function onFrameEnter(event:Event) { - try { - @:privateAccess - for(c in cameras) - c.render(); - } catch(e) { - trace(e.toString()); - } - } - - public function destroy() { - for(c in cameras) - c.destroy(); - window.close(); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/DesktopUtils.hx b/source/funkin/desktop/DesktopUtils.hx deleted file mode 100644 index 92fa8fe6..00000000 --- a/source/funkin/desktop/DesktopUtils.hx +++ /dev/null @@ -1,10 +0,0 @@ -package funkin.desktop; - - -class DesktopUtils { - public static inline function copyProperties(spr1:FlxObject, spr2:FlxObject) { - spr1.cameras = spr2.cameras; - spr1.setPosition(spr2.x, spr2.y); - spr1.scrollFactor.set(spr2.scrollFactor.x, spr2.scrollFactor.y); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/CharacterEditor.hx b/source/funkin/desktop/editors/CharacterEditor.hx deleted file mode 100644 index 9d6a479a..00000000 --- a/source/funkin/desktop/editors/CharacterEditor.hx +++ /dev/null @@ -1,341 +0,0 @@ -package funkin.desktop.editors; - -import funkin.game.Character; - -using funkin.utils.XMLUtil; - -class CharacterEditor extends WindowContent { - public function new(curCharacter:String) { - super('Character Editor - Loading...', 0, 0, 1200, 600); - } - - public var camHUD:FlxCamera; - public var char:Character; - public var curCharacter:String; - public var camFollow:FlxObject; - public var tabView:TabView; - - public var animList:Array = []; - public var animListNames:Array = []; - - public var curAnim:AnimData; - - public var menuBar:MenuBar; - - /** - * SILHOUETTES - */ - public var silhouetteDad:Character; - public var silhouetteGf:Character; - public var silhouetteBf:Character; - - /** - * ANIMATION TAB - */ - public var animsDropDown:DropDown; - public var animNameInput:InputBox; - public var animPrefixInput:InputBox; - public var animLoopCheckbox:Checkbox; - public var animFpsStepper:NumericStepper; - public var animOffsetX:NumericStepper; - public var animOffsetY:NumericStepper; - - /** - * CHARACTER SETTINGS TAB - */ - public var charSpriteInput:InputBox; - public var charIconInput:InputBox; - public var charIsPlayerCheckbox:Checkbox; - public var charIsGFCheckbox:Checkbox; - public var charOffsetXStepper:NumericStepper; - public var charOffsetYStepper:NumericStepper; - public var charHoldTimeStepper:NumericStepper; - public var charFlipXCheckbox:Checkbox; - public var charScaleStepper:NumericStepper; - public var charAntialiasingCheckbox:Checkbox; - - public override function create() { - super.create(); - - // camera stuff - parent.windowCameras[0].resizeScroll = false; - camHUD = new FlxCamera(0, 0, 1200, 600, 1); - camHUD.pixelPerfectRender = true; - camHUD.bgColor = 0; - parent.addCamera(camHUD); - - // stage - var bg = new FlxSprite(-600, -200).loadAnimatedGraphic(Paths.image('stages/default/stageback')); - bg.scrollFactor.set(0.9, 0.9); - var stageFront = new FlxSprite(-600, 600).loadAnimatedGraphic(Paths.image('stages/default/stagefront')); - silhouetteDad = new Character(100, 100, "dad", false); - silhouetteGf = new Character(400, 130, "gf", false); - silhouetteGf.scrollFactor.set(0.95, 0.95); - silhouetteBf = new Character(770, 100, "bf", true); - - for (e in [silhouetteDad, silhouetteGf, silhouetteBf]) { - e.color = 0xFF000000; - e.visible = false; - e.alpha = 0.25; - } - - for (e in [bg, stageFront, silhouetteDad, silhouetteGf, silhouetteBf]) { - e.antialiasing = true; - add(e); - } - - char = new Character(100, 100, curCharacter, false, false); - add(char); - - title = 'Character Editor - ${char.curCharacter}.xml'; - - // character setup & following - var charMidpoint = char.getGraphicMidpoint(); - camFollow = new FlxObject(0, 0, 2, 2); - camFollow.setPosition(charMidpoint.x, charMidpoint.y); - add(camFollow); - charMidpoint.put(); - windowCamera.follow(camFollow, LOCKON, 999); - - // loading animations from character - animList = []; - if (char.xml != null) - for(anim in char.xml.nodes.anim) - animList.push(anim.extractAnimFromXML()); - - // interface setup - setupTabView(); - - // todo: menu bar handlers - menuBar = new MenuBar([ - { - name: "File", - options: [ - { - name: "New" - }, - { - name: "Open" - }, - { - name: "Save" - }, - { - name: "Save As..." - }, - { - name: "Exit" - } - ] - }, - { - name: "Edit", - options: [ - { - name: "Add Animation..." - }, - { - name: "Delete Animation" - } - ] - }, - { - name: "View", - options: [ - { - name: "Lock Camera on Character" - }, - { - name: "Reset Camera Position", - callback: resetCamPos - }, - { - name: "Reset Camera Zoom", - callback: resetCamZoom - }, - { - name: "Toggle Boyfriend Silhouette", - callback: toggleSilBF - }, - { - name: "Toggle Dad Silhouette", - callback: toggleSilDad - }, - { - name: "Toggle Girlfriend Silhouette", - callback: toggleSilGF - } - ] - }, - { - name: "Help", - options: [ - { - name: "Open Editor Documentation" - }, - { - name: "Open Engine Documentation" - } - ] - } - ]); - menuBar.cameras = [camHUD]; - add(menuBar); - } - - public function setupTabView() { - tabView = new TabView(800, 20, 400, 580, ["Animation Settings", "Character Settings"]); - tabView.updateAnchor(1, 0, [camHUD]); - add(tabView); - - addAnimTab(); - addCharTab(); - - refreshAnims(); - changeAnim(0); - } - - public function addAnimTab() { - var content:Array = []; - var label:WindowText = null; - - content.push(label = new WindowText(10, 10, 0, "Animations")); - content.push(animsDropDown = new DropDown(10, label.y + label.height, 380, [], function(id) { - changeAnim(id); - })); - - content.push(label = new WindowText(10, animsDropDown.y + animsDropDown.height + 10, 0, "Animation Name")); - content.push(animNameInput = new InputBox(10, label.y + label.height, 380, "")); - - content.push(label = new WindowText(10, animNameInput.y + animNameInput.height + 10, 0, "Animation Prefix")); - content.push(animPrefixInput = new InputBox(10, label.y + label.height, 380, "")); - - content.push(animLoopCheckbox = new Checkbox(10, animPrefixInput.y + animPrefixInput.height + 10, 380, "Loop")); - - content.push(label = new WindowText(10, animLoopCheckbox.y + animLoopCheckbox.height + 10, 0, "Animation FPS (Frames per second)")); - content.push(animFpsStepper = new NumericStepper(10, label.y + label.height, 380, 0)); - - content.push(label = new WindowText(10, animFpsStepper.y + animFpsStepper.height + 10, 0, "Animation Offset (Relative to scale)")); - content.push(animOffsetX = new NumericStepper(10, label.y + label.height, 180, 0)); - content.push(animOffsetY = new NumericStepper(200, label.y + label.height, 180, 0)); - - for(e in [animOffsetX, animOffsetY]) - e.increment = 10; - - for(spr in content) - tabView.tabs[0].add(spr); - } - - public function addCharTab() { - var content:Array = []; - var label:WindowText = null; - - content.push(label = new WindowText(10, 10, 0, "Sprite Name (images/characters/)")); - content.push(charSpriteInput = new InputBox(10, label.y + label.height, 380, char.xml.has.sprite ? char.xml.att.sprite : "")); - - content.push(label = new WindowText(10, content.last().y + content.last().height, 0, "Icon Name (images/icons/)")); - content.push(charIconInput = new InputBox(10, label.y + label.height, 380, char.icon.getDefault(""))); - - content.push(charIsPlayerCheckbox = new Checkbox(10, content.last().y + content.last().height + 10, 380, "Playable character")); - content.push(label = new WindowText(10, content.last().y + content.last().height, 380, "(Offsets are automatically fixed when playing as a non-playable character and vice versa)")); - charIsPlayerCheckbox.checked = char.xml.getAtt("isPlayer") == "true"; - - content.push(charIsGFCheckbox = new Checkbox(10, content.last().y + content.last().height + 10, 380, "Is Girlfriend")); - content.push(label = new WindowText(10, content.last().y + content.last().height, 380, "(Characters marked as Girlfriend will replace GF when used as opponent)")); - charIsGFCheckbox.checked = char.isGF; - - content.push(charFlipXCheckbox = new Checkbox(10, content.last().y + content.last().height + 10, 380, "Flip Horizontally")); - charFlipXCheckbox.checked = char.__baseFlipped != char.isPlayer; - - for(spr in content) - tabView.tabs[1].add(spr); - } - - public function changeAnim(id:Int) { - curAnim = animList[id]; - if (curAnim == null) return; - char.playAnim(curAnim.name, true); - - animNameInput.text = curAnim.name; - animPrefixInput.text = curAnim.anim; - animLoopCheckbox.setChecked(curAnim.loop); - animFpsStepper.value = curAnim.fps; - animOffsetX.value = curAnim.x; - animOffsetY.value = curAnim.y; - } - - public function refreshAnims() { - animListNames = [for(e in animList) e.name]; - animsDropDown.options = animListNames; - animsDropDown.onSelectionChange(0); - } - - public override function update(elapsed:Float) { - super.update(elapsed); - if (parent.focused) { - if (FlxG.keys.pressed.RIGHT) camFollow.x += elapsed * 500; - if (FlxG.keys.pressed.LEFT) camFollow.x -= elapsed * 500; - if (FlxG.keys.pressed.DOWN) camFollow.y += elapsed * 500; - if (FlxG.keys.pressed.UP) camFollow.y -= elapsed * 500; - } - - if (curAnim != null) { - // animation updating - var shouldUpdate = false; - var oldName:String = curAnim.name; - - var updateListAsWell = shouldUpdate = (curAnim.name != (curAnim.name = animNameInput.text)); - shouldUpdate = (curAnim.anim != (curAnim.anim = animPrefixInput.text)) || shouldUpdate; - shouldUpdate = (curAnim.fps != (curAnim.fps = Std.int(animFpsStepper.value))) || shouldUpdate; - shouldUpdate = (curAnim.loop != (curAnim.loop = animLoopCheckbox.checked)) || shouldUpdate; - shouldUpdate = (curAnim.x != (curAnim.x = animOffsetX.value)) || shouldUpdate; - shouldUpdate = (curAnim.y != (curAnim.y = animOffsetY.value)) || shouldUpdate; - - if (shouldUpdate) - updateCurAnim(oldName, updateListAsWell); - } - - char.isPlayer = char.playerOffsets = charIsPlayerCheckbox.checked; - char.isGF = charIsPlayerCheckbox.checked; - char.flipX = char.__baseFlipped = (charFlipXCheckbox.checked != char.isPlayer); - char.x = charIsPlayerCheckbox.checked ? 770 : 100; - } - - public function updateCurAnim(?oldName:String, updateListAsWell:Bool = false) { - if (oldName == null) - oldName = char.animation.curAnim != null ? char.animation.curAnim.name : curAnim.name; - - char.animation.remove(oldName); - char.animation.curAnim = null; - - XMLUtil.addAnimToSprite(char, curAnim); - - char.playAnim(curAnim.name, true); - } - - public override function onWindowResize(width:Int, height:Int) { - tabView.resize(400, height - 20); - } - - /** - * =========== CONTEXT MENU OPTIONS =========== - */ - - /** - * View - */ - public function resetCamPos() { - var pos = char.getCameraPosition(); - camFollow.setPosition(pos.x, pos.y); - } - public function resetCamZoom() { - windowCamera.zoom = 1; - } - - /** - * Silhouettes - */ - public function toggleSilBF() silhouetteBf.visible = !silhouetteBf.visible; - public function toggleSilDad() silhouetteDad.visible = !silhouetteDad.visible; - public function toggleSilGF() silhouetteGf.visible = !silhouetteGf.visible; -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/CommandPrompt.hx b/source/funkin/desktop/editors/CommandPrompt.hx deleted file mode 100644 index 362ab6f8..00000000 --- a/source/funkin/desktop/editors/CommandPrompt.hx +++ /dev/null @@ -1,12 +0,0 @@ -package funkin.desktop.editors; - -class CommandPrompt extends WindowContent { - public function new() { - super("Command Prompt", 100, 100, 960, 480); - } - - public override function create() { - super.create(); - windowCamera.bgColor = 0xFF000000; - } -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/EditorPlayState.hx b/source/funkin/desktop/editors/EditorPlayState.hx deleted file mode 100644 index e80f7614..00000000 --- a/source/funkin/desktop/editors/EditorPlayState.hx +++ /dev/null @@ -1,94 +0,0 @@ -package funkin.desktop.editors; - -import flixel.math.FlxPoint; - -class EditorPlayState extends WindowContent { - var state:PlayState; - - public function new() { - super("PlayState", 120, 120, 1280, 720); - state = new PlayState(); - } - public override function create() { - super.create(); - - beforeStateShit(); - state.camera = parent.windowCameras[0].camera; - state.create(); - afterStateShit(); - - parent.windowCameras[0].resizeScroll = false; - parent.windowCameras.push( - { - camera: state.camHUD, - width: 1280, - height: 720, - resizeScroll: true - } - ); - parent.move(winX, winY); - parent.resize(1280, 720); - beforeStateShit(); - state.createPost(); - afterStateShit(); - } - var oldSize = FlxPoint.get(FlxG.width, FlxG.height); - var oldCamList:Array; - var oldCam:FlxCamera; - - public function beforeStateShit() { - oldSize.set(FlxG.width, FlxG.height); - @:privateAccess - FlxG.width = 1280; - @:privateAccess - FlxG.height = 720; - - oldCamList = FlxG.cameras.list; - oldCam = FlxG.camera; - @:privateAccess - FlxG.cameras.list = [for(e in parent.windowCameras) e.camera]; - FlxG.camera = parent.windowCameras[0].camera; - } - public function afterStateShit() { - @:privateAccess - FlxG.width = Std.int(oldSize.x); - @:privateAccess - FlxG.height = Std.int(oldSize.y); - - parent.windowCameras = [for(e in FlxG.cameras.list) { - camera: e, - width: 1280, - height: 720, - resizeScroll: false - }]; - @:privateAccess - FlxG.cameras.list = oldCamList; - FlxG.camera = oldCam; - - oldCamList = null; - oldCam = null; - } - - public override function update(elapsed:Float) { - beforeStateShit(); - super.update(elapsed); - @:privateAccess - FlxG.cameras.update(elapsed); - state.tryUpdate(elapsed); - afterStateShit(); - } - - public override function destroy() { - beforeStateShit(); - super.destroy(); - state.destroy(); - afterStateShit(); - } - - public override function draw() { - beforeStateShit(); - super.draw(); - state.draw(); - afterStateShit(); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/HelloWorld.hx b/source/funkin/desktop/editors/HelloWorld.hx deleted file mode 100644 index 0c89a99a..00000000 --- a/source/funkin/desktop/editors/HelloWorld.hx +++ /dev/null @@ -1,58 +0,0 @@ -package funkin.desktop.editors; - -import flixel.util.FlxDestroyUtil.IFlxDestroyable; -import flixel.addons.ui.FlxUIText; - -class HelloWorld extends WindowContent { - public override function new() { - super("Test Window", 100, 100, 640, 480); - } - - public override function create() { - super.create(); - - var helloWorldText = new WindowText(0, 0, 0, "Hello, World!"); - helloWorldText.scrollFactor.set(0.5, 0.5); - helloWorldText.cameraCenter(camera); - add(helloWorldText); - - var t = new WindowText(0, 0, 0, "Bottom right text!"); - t.setPosition(630 - t.width, 470 - t.height); - t.scrollFactor.set(1, 1); - add(t); - - var tabs = new TabView(330, 10, 300, 500, ["Tab 1", "Tab 2", "Tab 3"]); - tabs.updateAnchor(1, 0); - add(tabs); - - - var checkbox = new Checkbox(10, 40, 0, "Test Checkbox", CHECKED); - var text = new WindowText(10, 10, 180, "Stuff in page 1"); - tabs.tabs[0].add(text); - tabs.tabs[0].add(checkbox); - - var text2 = new WindowText(10, 10, 180, "Stuff in page 2"); - tabs.tabs[1].add(text2); - - var butt = new Button(10, 10, "Test", function() { - parent.showMessage("Test", "Test", ERROR); - }); - butt.scrollFactor.set(); - add(butt); - } - - public var time:Float = 0; - public var coolAssMode:Bool = false; - public override function update(elapsed:Float) { - super.update(elapsed); - time += elapsed; - - if (FlxG.keys.justPressed.M) coolAssMode = !coolAssMode; - - if (coolAssMode) { - width = 500 + Std.int(Math.cos(time * Math.PI) * 250); - height = 500 + Std.int(Math.sin(time * Math.PI) * 250); - } - parent.updateWindowFrame(); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/MessageBox.hx b/source/funkin/desktop/editors/MessageBox.hx deleted file mode 100644 index 34dc27bf..00000000 --- a/source/funkin/desktop/editors/MessageBox.hx +++ /dev/null @@ -1,72 +0,0 @@ -package funkin.desktop.editors; - -import flixel.util.typeLimit.OneOfTwo; -import flixel.util.FlxDestroyUtil.IFlxDestroyable; -import flixel.addons.ui.FlxUIText; - -class MessageBox extends WindowContent { - public var caption:String; - public var message:String; - public var msgIcon:MessageBoxIcon; - public var callback:Int->Void = null; - private var __buttons:Array> = null; - - public override function new(caption:String, message:String, icon:MessageBoxIcon, ?buttons:Array>, ?callback:Int->Void) { - super(caption, 100, 100, 500, 500); - this.caption = caption; - this.message = message; - this.msgIcon = icon; - this.callback = callback; - this.__buttons = buttons; - } - - public override function create() { - super.create(); - parent.canMinimize = parent.resizeable = false; - var text = new WindowText(10, 10, 0, message); - if (text.width > 500) - text.fieldWidth = 500; - add(text); - setSize(Std.int(Math.max(text.width + 20, 240)), Std.int(text.height + 20)); - - - if (__buttons == null || __buttons.length <= 0) __buttons = ["OK"]; - - var firstButt:Button = null; - for(k=>b in __buttons) { - var label:String = null; - var callback:Void->Void = null; - if (b is String) { - label = cast(b, String); - } else if (b is Dynamic) { - label = Reflect.field(b, "label"); - callback = Reflect.field(b, "callback"); - } - var button = new Button(490, 490, label, function() { - parent.close(); - if (callback != null) callback(); - if (this.callback != null) this.callback(k); - }); - button.x -= button.width; - button.y -= button.height; - button.scrollFactor.set(1, 1); - add(button); - if (firstButt == null) firstButt = button; - } - setSize(Std.int(width), Std.int(height + firstButt.height + 10)); - } -} - -@:enum -abstract MessageBoxIcon(Int) { - var ERROR = 0; - var ALERT = 1; - var INFORMATION = 2; - var QUESTION = 3; -} - -// HAHA BUTT!! *minion laugh* -typedef Butt = { - var label:String; - @:optional var callback:Void->Void; -} \ No newline at end of file diff --git a/source/funkin/desktop/editors/import.hx b/source/funkin/desktop/editors/import.hx deleted file mode 100644 index cc04c4bb..00000000 --- a/source/funkin/desktop/editors/import.hx +++ /dev/null @@ -1,4 +0,0 @@ -package funkin.desktop.editors; - -import funkin.desktop.windows.*; -import funkin.desktop.sprites.*; \ No newline at end of file diff --git a/source/funkin/desktop/import.hx b/source/funkin/desktop/import.hx deleted file mode 100644 index f5d0ee4e..00000000 --- a/source/funkin/desktop/import.hx +++ /dev/null @@ -1,3 +0,0 @@ -using funkin.desktop.DesktopUtils; -using funkin.desktop.windows.ContextMenu; -using funkin.desktop.DesktopMain; \ No newline at end of file diff --git a/source/funkin/desktop/sprites/Button.hx b/source/funkin/desktop/sprites/Button.hx deleted file mode 100644 index 8a4cb844..00000000 --- a/source/funkin/desktop/sprites/Button.hx +++ /dev/null @@ -1,126 +0,0 @@ -package funkin.desktop.sprites; - -import funkin.desktop.DesktopMain.IDesktopFocusableObject; -import funkin.desktop.theme.Theme; -import flixel.addons.ui.FlxUIText; -import flixel.math.FlxPoint; -import funkin.desktop.windows.WindowGroup; - -using funkin.desktop.DesktopMain; - -class Button extends FlxObject implements IDesktopFocusableObject { - public var callback:Void->Void; - - public var disabled:Bool = false; - - public var frame:Int = 0; - - public var normalSprite:SpliceSprite; - public var hoverSprite:SpliceSprite; - public var pressedSprite:SpliceSprite; - public var disabledSprite:SpliceSprite; - - public var label:WindowText; - - private override function get_width() { - return normalSprite.width; - } - - private override function get_height() { - return normalSprite.height; - } - - public function new(x:Float, y:Float, text:String = "", callback:Void->Void, ?normalButton:ThemeData, ?hoverButton:ThemeData, ?pressedButton:ThemeData, ?disabledButton:ThemeData) { - super(); - this.x = x; - this.y = y; - this.width = 75; - this.height = 24; - this.callback = callback; - - scrollFactor.set(); - - if (normalButton == null) normalButton = DesktopMain.theme.normalButton; - if (hoverButton == null) hoverButton = DesktopMain.theme.hoverButton; - if (pressedButton == null) pressedButton = DesktopMain.theme.pressedButton; - if (disabledButton == null) disabledButton = DesktopMain.theme.disabledButton; - - normalSprite = new SpliceSprite(Paths.image(normalButton.sprite), x, y, 75, 24, normalButton.left, normalButton.top, normalButton.bottom, normalButton.right); - hoverSprite = new SpliceSprite(Paths.image(hoverButton.sprite), x, y, 75, 24, hoverButton.left, hoverButton.top, hoverButton.bottom, hoverButton.right); - pressedSprite = new SpliceSprite(Paths.image(pressedButton.sprite), x, y, 75, 24, pressedButton.left, pressedButton.top, pressedButton.bottom, pressedButton.right); - disabledSprite = new SpliceSprite(Paths.image(disabledButton.sprite), x, y, 75, 24, disabledButton.left, disabledButton.top, disabledButton.bottom, disabledButton.right); - - label = new WindowText(0, 0, 75, text); - label.alignment = CENTER; - } - - public override function update(elapsed:Float) { - super.update(elapsed); - var mouseInput = DesktopMain.mouseInput; - if (mouseInput.overlaps(normalSprite, camera)) { - if (mouseInput.justReleased) { - callback(); - return; - } - - if (mouseInput.justPressed || mouseInput.pressed) { - this.setFocus(); - frame = 2; - } - else - frame = 1; - mouseInput.cancel(); - } else - frame = 0; - - if (disabled) frame = 3; - - for(e in [normalSprite, hoverSprite, pressedSprite, disabledSprite]) - e.update(elapsed); - - label.color = switch(frame) { - case 1: DesktopMain.theme.hoverButton.textColor; - case 2: DesktopMain.theme.pressedButton.textColor; - case 3: DesktopMain.theme.disabledButton.textColor; - default: DesktopMain.theme.normalButton.textColor; - } - } - - public override function destroy() { - DesktopMain.loseFocus(this); - - for(e in [normalSprite, hoverSprite, pressedSprite, disabledSprite]) - e.destroy(); - scrollFactor.put(); - super.destroy(); - } - - public function resize(width:Float, height:Float) { - this.width = width; - this.height = height; - normalSprite.resize(width, height); - label.fieldWidth = width; - } - public override function draw() { - super.draw(); - var spr = switch(frame) { - case 1: hoverSprite; - case 2: pressedSprite; - case 3: disabledSprite; - default: normalSprite; - }; - spr.resize(width, height); - for(sprite in [spr, label]) - sprite.copyProperties(this); - spr.draw(); - label.y += (height - label.height) / 2; - label.draw(); - additionalDraw(); - } - - public function additionalDraw() {} - - - public function onFocus() {} - public function onFocusLost() {} -} \ No newline at end of file diff --git a/source/funkin/desktop/sprites/Checkbox.hx b/source/funkin/desktop/sprites/Checkbox.hx deleted file mode 100644 index cca044e5..00000000 --- a/source/funkin/desktop/sprites/Checkbox.hx +++ /dev/null @@ -1,70 +0,0 @@ -package funkin.desktop.sprites; - -import flixel.math.FlxRect; -import flixel.text.FlxText; - -class Checkbox extends WindowText { - public var checked:CheckState = UNCHECKED; - public var disabled:Bool = false; - public var checkboxSprite:FlxSprite; - - public function new(x:Float, y:Float, w:Float, t:String, checked:CheckState = UNCHECKED) { - super(x, y, w, t); - this.checked = checked; - offset.x -= 20; - - var t = DesktopMain.theme.checkbox; - - checkboxSprite = new FlxSprite(0, (20 - t.height) / 2); - checkboxSprite.loadGraphic(Paths.image(t.sprite), true, Std.int(t.width), Std.int(t.height)); - checkboxSprite.animation.add("checkbox", [for(i in 0...checkboxSprite.frames.frames.length) i], 0, true); - checkboxSprite.animation.play("checkbox"); - - scrollFactor.set(); - } - - public function setChecked(checked:Bool) { - this.checked = cast checked; - } - - public override function update(elapsed:Float) { - super.update(elapsed); - checkboxSprite.update(elapsed); - - var overlaps = DesktopMain.mouseInput.overlapsRect(this, new FlxRect(x, y, width + 20, height), camera); - var pressed = DesktopMain.mouseInput.pressed; - - if (overlaps) { - // cancel so that sprites in the bg dont get hovered as well - if (!disabled && DesktopMain.mouseInput.justPressed) { - checked = switch(checked) { - case CHECKED | BOTH: - UNCHECKED; - case UNCHECKED: - CHECKED; - } - } - DesktopMain.mouseInput.cancel(); - } - - checkboxSprite.animation.curAnim.curFrame = (switch(checked) { - case UNCHECKED: 0; - case CHECKED: 1; - case BOTH: 2; - }) + (disabled ? 9 : (overlaps ? (pressed ? 6 : 3) : 0)); - } - - public override function draw() { - checkboxSprite.copyProperties(this); - rotOffset.y = (this.height - checkboxSprite.height) / 2; - super.draw(); - checkboxSprite.draw(); - } -} - -@:enum -abstract CheckState(Null) from Null to Null from Bool to Bool { - var CHECKED:CheckState = true; - var UNCHECKED:CheckState = false; - var BOTH:CheckState = null; -} \ No newline at end of file diff --git a/source/funkin/desktop/sprites/DropDown.hx b/source/funkin/desktop/sprites/DropDown.hx deleted file mode 100644 index d4d5c82f..00000000 --- a/source/funkin/desktop/sprites/DropDown.hx +++ /dev/null @@ -1,40 +0,0 @@ -package funkin.desktop.sprites; - -import funkin.desktop.theme.Theme.ThemeData; -import flixel.math.FlxPoint; - -class DropDown extends Button { - public var selectedIndex:Int = -1; - public var onChange:Int->Void; - public var options:Array; - - public function new(x:Float, y:Float, w:Float, options:Array, onChange:Int->Void, curId:Int = 0, ?normalButton:ThemeData, ?hoverButton:ThemeData, ?pressedButton:ThemeData, ?disabledButton:ThemeData) { - super(x, y, "", onClick, normalButton, hoverButton, pressedButton, disabledButton); - this.options = options; - onSelectionChange(curId); - this.onChange = onChange; - } - - public function onClick() { - var pos:FlxPoint = getScreenPosition(null, camera); - pos.y += height; - - var camPos = camera != null ? FlxPoint.get(camera.x, camera.y) : FlxPoint.get(); - - ContextMenu.open(pos.x + camPos.x, pos.y + camPos.y, [for(o in options) { - { - name: o - } - }], onSelectionChange); - - pos.put(); - camPos.put(); - } - - public function onSelectionChange(id:Int) { - selectedIndex = id; - label.text = options[id]; - if (onChange != null) - onChange(id); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/sprites/InputBox.hx b/source/funkin/desktop/sprites/InputBox.hx deleted file mode 100644 index 48d861c1..00000000 --- a/source/funkin/desktop/sprites/InputBox.hx +++ /dev/null @@ -1,105 +0,0 @@ -package funkin.desktop.sprites; - -import openfl.ui.Keyboard; -import openfl.events.KeyboardEvent; -import lime.app.Application; - -class InputBox extends Button implements IDesktopInputObject { - public var index:Int = 0; - public static var insertMode:Bool = false; - - public var text(get, set):String; - private inline function set_text(t:String):String - return label.text = t; - private inline function get_text():String - return label.text; - - public var onChange:Void->Void; - public var onConfirm:Void->Void; - - public function new(x:Float, y:Float, w:Float, t:String, ?onChange:Void->Void) { - super(x, y, t, function() { - setIndex(label.text.length); - disabled = true; - }, DesktopMain.theme.textbox, DesktopMain.theme.textboxHover, DesktopMain.theme.textboxPressed, DesktopMain.theme.textboxFocused); - this.resize(w, height); - this.label.alignment = LEFT; - FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); - Application.current.window.onTextInput.add(onTextInput); - } - - - private function onKeyDown(event:KeyboardEvent) { - if (!this.hasFocus()) return; - switch(event.keyCode) { - case Keyboard.ESCAPE: - this.loseFocus(); - case Keyboard.INSERT: - insertMode = !insertMode; - case Keyboard.LEFT: - changeIndex(-1); - case Keyboard.RIGHT: - changeIndex(1); - case Keyboard.HOME: - setIndex(0); - case Keyboard.END: - setIndex(text.length); - case Keyboard.DELETE: - text = text.substr(0, index) + text.substring(index + 1, text.length); - onTextInput(""); - case Keyboard.BACKSPACE: - text = text.substr(0, index <= 0 ? 0 : index - 1) + text.substring(index, text.length); - changeIndex(-1); - onTextInput(""); - case Keyboard.ENTER | Keyboard.NUMPAD_ENTER: - if (onChange != null) - onChange(); - if (onConfirm != null) - onConfirm(); - default: - // nothing - } - } - - private function onTextInput(input:String) { - if (!this.hasFocus()) return; - - if (input.length > 0) { - text = text.substr(0, index) + input + text.substring(index, text.length); - - if (!insertMode) - index += input.length; - } - - if (onChange != null) - onChange(); - } - - public override function update(elapsed:Float) { - if (DesktopMain.mouseInput.justPressed && !DesktopMain.mouseInput.overlaps(this, camera)) - this.loseFocus(); - super.update(elapsed); - } - - public override function onFocusLost() { - super.onFocusLost(); - if (disabled != (disabled = false)) { - if (onChange != null) - onChange(); - if (onConfirm != null) - onConfirm(); - } - } - - public inline function changeIndex(change:Int) { - setIndex(Std.int(FlxMath.bound(index + change, 0, label.text.length))); - } - - public inline function setIndex(index:Int) { - this.index = index; - } - - public override function destroy() { - super.destroy(); - } -} \ No newline at end of file diff --git a/source/funkin/desktop/sprites/MenuBar.hx b/source/funkin/desktop/sprites/MenuBar.hx deleted file mode 100644 index 3655f6f0..00000000 --- a/source/funkin/desktop/sprites/MenuBar.hx +++ /dev/null @@ -1,52 +0,0 @@ -package funkin.desktop.sprites; - -import flixel.math.FlxPoint; -import funkin.desktop.windows.WindowGroup; - -class MenuBar extends WindowGroup { - public var spr:FlxSprite; - public var buttons:Array