diff --git a/assets/images/desktop/ui.xml b/assets/images/desktop/ui.xml index 40df3f67..9db8fcb2 100644 --- a/assets/images/desktop/ui.xml +++ b/assets/images/desktop/ui.xml @@ -1,16 +1,23 @@ - - - - + + + + - - - - + + + + - + + + + + + + + \ No newline at end of file diff --git a/assets/images/desktop/ui/buttonHover.png b/assets/images/desktop/ui/buttonHover.png index a178e6c7..28f0f77d 100644 Binary files a/assets/images/desktop/ui/buttonHover.png and b/assets/images/desktop/ui/buttonHover.png differ diff --git a/assets/images/desktop/ui/tab.png b/assets/images/desktop/ui/tab.png new file mode 100644 index 00000000..265deb76 Binary files /dev/null and b/assets/images/desktop/ui/tab.png differ diff --git a/assets/images/desktop/ui/tabBody.png b/assets/images/desktop/ui/tabBody.png new file mode 100644 index 00000000..ced1caa0 Binary files /dev/null and b/assets/images/desktop/ui/tabBody.png differ diff --git a/assets/images/desktop/ui/tabHover.png b/assets/images/desktop/ui/tabHover.png new file mode 100644 index 00000000..28f0f77d Binary files /dev/null and b/assets/images/desktop/ui/tabHover.png differ diff --git a/assets/images/desktop/ui/tabNonSelected.png b/assets/images/desktop/ui/tabNonSelected.png new file mode 100644 index 00000000..b644b3f5 Binary files /dev/null and b/assets/images/desktop/ui/tabNonSelected.png differ diff --git a/assets/images/desktop/ui/tabPressed.png b/assets/images/desktop/ui/tabPressed.png new file mode 100644 index 00000000..113d5f7e Binary files /dev/null and b/assets/images/desktop/ui/tabPressed.png differ diff --git a/buildnumber.txt b/buildnumber.txt index 870e31e0..3755801a 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1697 \ No newline at end of file +1712 \ No newline at end of file diff --git a/source/funkin/desktop/editors/HelloWorld.hx b/source/funkin/desktop/editors/HelloWorld.hx index a93294b7..275baf4f 100644 --- a/source/funkin/desktop/editors/HelloWorld.hx +++ b/source/funkin/desktop/editors/HelloWorld.hx @@ -22,20 +22,24 @@ class HelloWorld extends WindowContent { t.scrollFactor.set(1, 1); add(t); - var t = new WindowText(0, 0, 0, "Top right text!"); - t.setPosition(630 - t.width, 10); - t.scrollFactor.set(1, 0); - add(t); + var tabs = new TabView(330, 10, 300, 500, ["Tab 1", "Tab 2", "Tab 3"]); + tabs.updateScrollFactor(0, 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); - - var checkbox = new Checkbox(10, 40, 0, "Test Checkbox", CHECKED); - checkbox.scrollFactor.set(); - add(checkbox); } public var time:Float = 0; diff --git a/source/funkin/desktop/editors/MessageBox.hx b/source/funkin/desktop/editors/MessageBox.hx index b3da4605..3a70cb39 100644 --- a/source/funkin/desktop/editors/MessageBox.hx +++ b/source/funkin/desktop/editors/MessageBox.hx @@ -50,6 +50,7 @@ class MessageBox extends WindowContent { }); button.x -= button.width; button.y -= button.height; + button.scrollFactor.set(1, 1); add(button); if (firstButt == null) firstButt = button; } diff --git a/source/funkin/desktop/sprites/Button.hx b/source/funkin/desktop/sprites/Button.hx index bee4f808..52b19a05 100644 --- a/source/funkin/desktop/sprites/Button.hx +++ b/source/funkin/desktop/sprites/Button.hx @@ -29,7 +29,7 @@ class Button extends FlxObject { return normalSprite.height; } - public function new(x:Float, y:Float, text:String = "", callback:Void->Void) { + 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; @@ -37,10 +37,12 @@ class Button extends FlxObject { this.height = 24; this.callback = callback; - var normalButton = DesktopMain.theme.normalButton; - var hoverButton = DesktopMain.theme.hoverButton; - var pressedButton = DesktopMain.theme.pressedButton; - var disabledButton = DesktopMain.theme.disabledButton; + 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); diff --git a/source/funkin/desktop/sprites/Checkbox.hx b/source/funkin/desktop/sprites/Checkbox.hx index e541f151..8a16772a 100644 --- a/source/funkin/desktop/sprites/Checkbox.hx +++ b/source/funkin/desktop/sprites/Checkbox.hx @@ -21,6 +21,8 @@ class Checkbox extends WindowText { 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 override function update(elapsed:Float) { diff --git a/source/funkin/desktop/sprites/SpliceSprite.hx b/source/funkin/desktop/sprites/SpliceSprite.hx index 0fa2784d..549af3ab 100644 --- a/source/funkin/desktop/sprites/SpliceSprite.hx +++ b/source/funkin/desktop/sprites/SpliceSprite.hx @@ -28,6 +28,8 @@ class SpliceSprite extends FlxObject { this.width = width; this.height = height; + scrollFactor.set(); + __internalSprite = new FlxSprite(0, 0, spr); slice = [Std.int(left), Std.int(bottom), Std.int(top), Std.int(right)]; diff --git a/source/funkin/desktop/sprites/TabView.hx b/source/funkin/desktop/sprites/TabView.hx new file mode 100644 index 00000000..69ff37ae --- /dev/null +++ b/source/funkin/desktop/sprites/TabView.hx @@ -0,0 +1,92 @@ +package funkin.desktop.sprites; + +import flixel.math.FlxRect; +import flixel.FlxSprite; +import flixel.FlxBasic; +import funkin.desktop.windows.WindowGroup; + +class TabView extends WindowGroup { + public var tabBG:SpliceSprite; + public var tabButtons:Array