From f69a41a0ed4e4a03f6c917055b0358f8b4db65f5 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Fri, 23 Dec 2022 21:29:29 +0100 Subject: [PATCH] small character editor progress --- assets/images/desktop/ui/topbar.png | Bin 0 -> 116 bytes buildnumber.txt | 2 +- .../funkin/desktop/editors/CharacterEditor.hx | 27 +++++++++++++----- source/funkin/desktop/editors/HelloWorld.hx | 2 +- source/funkin/desktop/import.hx | 3 +- source/funkin/desktop/sprites/TabView.hx | 1 + source/funkin/desktop/sprites/TopMenu.hx | 15 ++++++++++ source/funkin/desktop/windows/Window.hx | 1 + .../funkin/desktop/windows/WindowContent.hx | 3 ++ source/funkin/desktop/windows/WindowGroup.hx | 18 ++++++------ 10 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 assets/images/desktop/ui/topbar.png create mode 100644 source/funkin/desktop/sprites/TopMenu.hx diff --git a/assets/images/desktop/ui/topbar.png b/assets/images/desktop/ui/topbar.png new file mode 100644 index 0000000000000000000000000000000000000000..7e33f3238904f535ada21a2a2bcff2524c5e604d GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VXMsm#F#`kNVGw3Kp1&dmD5&P? z;uunKE7_*t!GT~lEv93E%)7(7Obf0YNK97{kYBK@k)f^E>g1zC)53r{7(8A5 KT-G@yGywp! { + public function new(trees:Array) { + super(); + } +} + +typedef TopMenuTree = { + var name:String; + var options:Array; +} \ No newline at end of file diff --git a/source/funkin/desktop/windows/Window.hx b/source/funkin/desktop/windows/Window.hx index 7129bc9c..fa22c47a 100644 --- a/source/funkin/desktop/windows/Window.hx +++ b/source/funkin/desktop/windows/Window.hx @@ -299,5 +299,6 @@ class Window extends FlxTypedGroup { e.camera.scroll.set(-Std.int(e.camera.width - e.width), -Std.int(e.camera.height - e.height)); } } + content.onWindowResize(windowWidth, windowHeight); } } \ No newline at end of file diff --git a/source/funkin/desktop/windows/WindowContent.hx b/source/funkin/desktop/windows/WindowContent.hx index 4f8a866e..2a1aea5f 100644 --- a/source/funkin/desktop/windows/WindowContent.hx +++ b/source/funkin/desktop/windows/WindowContent.hx @@ -81,6 +81,9 @@ class WindowContent extends WindowGroup { } + public function onWindowResize(width:Int, height:Int) { + + } public function onDesktopSizeChange(width:Int, height:Int) { diff --git a/source/funkin/desktop/windows/WindowGroup.hx b/source/funkin/desktop/windows/WindowGroup.hx index a1b30da8..210e05af 100644 --- a/source/funkin/desktop/windows/WindowGroup.hx +++ b/source/funkin/desktop/windows/WindowGroup.hx @@ -21,36 +21,34 @@ class WindowGroup extends FlxTypedGroup { var o = cast(obj, FlxObject); o.x += x; o.y += y; - o.scrollFactor.x = scrollFactor.x; - o.scrollFactor.y = scrollFactor.y; } else if (obj is WindowGroup) { var o:WindowGroup = cast obj; o.x += x; o.y += y; - o.scrollFactor.x = scrollFactor.x; - o.scrollFactor.y = scrollFactor.y; } + __updateObjScrollFactor(obj); return obj; } - public function updateScrollFactor(x:Float, y:Float) { + public function updateAnchor(x:Float, y:Float, ?cameras:Array) { scrollFactor.set(x, y); + if (cameras != null) this.cameras = cameras; if (!updateScrolls) return; for(obj in members) - __updateObjScrollFactor(obj); + __updateObjScrollFactor(obj, cameras); } - private function __updateObjScrollFactor(obj:FlxBasic) { + private function __updateObjScrollFactor(obj:FlxBasic, ?cameras:Array) { if (obj is FlxObject) { var o = cast(obj, FlxObject); - o.scrollFactor.x = scrollFactor.x; - o.scrollFactor.y = scrollFactor.y; + if (cameras != null) o.cameras = cameras; + o.scrollFactor.set(scrollFactor.x, scrollFactor.y); } else if (obj is WindowGroup) { var o:WindowGroup = cast obj; - o.updateScrollFactor(scrollFactor.x, scrollFactor.y); + o.updateAnchor(scrollFactor.x, scrollFactor.y, cameras); } }