diff --git a/assets/images/desktop/ui/topbar.png b/assets/images/desktop/ui/topbar.png new file mode 100644 index 00000000..7e33f323 Binary files /dev/null and b/assets/images/desktop/ui/topbar.png differ diff --git a/buildnumber.txt b/buildnumber.txt index 6b71fd4e..72078b7c 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1719 \ No newline at end of file +1729 \ No newline at end of file diff --git a/source/funkin/desktop/editors/CharacterEditor.hx b/source/funkin/desktop/editors/CharacterEditor.hx index 364fe08b..85adce7a 100644 --- a/source/funkin/desktop/editors/CharacterEditor.hx +++ b/source/funkin/desktop/editors/CharacterEditor.hx @@ -8,20 +8,21 @@ import flixel.FlxG; class CharacterEditor extends WindowContent { public function new(curCharacter:String) { - super('Character Editor - Loading...', 0, 0, 800, 600); + 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 override function create() { super.create(); // camera stuff parent.windowCameras[0].resizeScroll = false; - camHUD = new FlxCamera(800, 600, 1); + camHUD = new FlxCamera(0, 0, 1200, 600, 1); camHUD.pixelPerfectRender = true; camHUD.bgColor = 0; parent.addCamera(camHUD); @@ -31,24 +32,32 @@ class CharacterEditor extends WindowContent { bg.scrollFactor.set(0.9, 0.9); var stageFront = new FlxSprite(-600, 600).loadAnimatedGraphic(Paths.image('stages/default/stagefront')); - stageFront.scrollFactor.set(0.9, 0.9); char = new Character(100, 100, curCharacter, false, false); - for(e in [bg, stageFront]) { + for(e in [bg, stageFront]) e.antialiasing = true; - } add(bg); add(stageFront); add(char); + title = 'Character Editor - ${char.curCharacter}.xml'; + // character setup & following - camFollow = new FlxObject(0, 0, 2, 2); var charMidpoint = char.getGraphicMidpoint(); + camFollow = new FlxObject(0, 0, 2, 2); camFollow.setPosition(charMidpoint.x, charMidpoint.y); add(camFollow); windowCamera.follow(camFollow, LOCKON, 999); - title = 'Character Editor - ${char.curCharacter}.xml'; + + // interface setup + setupTabView(); + } + + public function setupTabView() { + tabView = new TabView(800, 20, 400, 580, ["Animation Settings", "Character Settings"]); + tabView.updateAnchor(1, 0, [camHUD]); + add(tabView); } public override function update(elapsed:Float) { @@ -60,4 +69,8 @@ class CharacterEditor extends WindowContent { if (FlxG.keys.pressed.UP) camFollow.y -= elapsed * 500; } } + + public override function onWindowResize(width:Int, height:Int) { + tabView.resize(400, height - 20); + } } \ No newline at end of file diff --git a/source/funkin/desktop/editors/HelloWorld.hx b/source/funkin/desktop/editors/HelloWorld.hx index 275baf4f..4b3b71df 100644 --- a/source/funkin/desktop/editors/HelloWorld.hx +++ b/source/funkin/desktop/editors/HelloWorld.hx @@ -23,7 +23,7 @@ class HelloWorld extends WindowContent { add(t); var tabs = new TabView(330, 10, 300, 500, ["Tab 1", "Tab 2", "Tab 3"]); - tabs.updateScrollFactor(0, 0); + tabs.updateAnchor(1, 0); add(tabs); diff --git a/source/funkin/desktop/import.hx b/source/funkin/desktop/import.hx index 764de2d5..0d58811c 100644 --- a/source/funkin/desktop/import.hx +++ b/source/funkin/desktop/import.hx @@ -1 +1,2 @@ -using funkin.desktop.DesktopUtils; \ No newline at end of file +using funkin.desktop.DesktopUtils; +using funkin.desktop.windows.ContextMenu; \ No newline at end of file diff --git a/source/funkin/desktop/sprites/TabView.hx b/source/funkin/desktop/sprites/TabView.hx index 69ff37ae..44fe9ab3 100644 --- a/source/funkin/desktop/sprites/TabView.hx +++ b/source/funkin/desktop/sprites/TabView.hx @@ -1,5 +1,6 @@ package funkin.desktop.sprites; +import flixel.FlxObject; import flixel.math.FlxRect; import flixel.FlxSprite; import flixel.FlxBasic; diff --git a/source/funkin/desktop/sprites/TopMenu.hx b/source/funkin/desktop/sprites/TopMenu.hx new file mode 100644 index 00000000..1d45f87c --- /dev/null +++ b/source/funkin/desktop/sprites/TopMenu.hx @@ -0,0 +1,15 @@ +package funkin.desktop.sprites; + +import flixel.FlxBasic; +import funkin.desktop.windows.WindowGroup; + +class TopMenu extends WindowGroup { + 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); } }