From 0de262a7deb4224570b5522de14ebc15e3ed796d Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Fri, 23 Dec 2022 02:47:00 +0100 Subject: [PATCH] desktop progress --- assets/images/desktop/ui.xml | 25 +++-- assets/images/desktop/ui/buttonHover.png | Bin 257 -> 245 bytes assets/images/desktop/ui/tab.png | Bin 0 -> 156 bytes assets/images/desktop/ui/tabBody.png | Bin 0 -> 141 bytes assets/images/desktop/ui/tabHover.png | Bin 0 -> 245 bytes assets/images/desktop/ui/tabNonSelected.png | Bin 0 -> 160 bytes assets/images/desktop/ui/tabPressed.png | Bin 0 -> 442 bytes buildnumber.txt | 2 +- source/funkin/desktop/editors/HelloWorld.hx | 20 ++-- source/funkin/desktop/editors/MessageBox.hx | 1 + source/funkin/desktop/sprites/Button.hx | 12 ++- source/funkin/desktop/sprites/Checkbox.hx | 2 + source/funkin/desktop/sprites/SpliceSprite.hx | 2 + source/funkin/desktop/sprites/TabView.hx | 92 ++++++++++++++++++ source/funkin/desktop/sprites/WindowText.hx | 2 + source/funkin/desktop/theme/Theme.hx | 9 ++ .../funkin/desktop/windows/WindowContent.hx | 1 + source/funkin/desktop/windows/WindowGroup.hx | 54 ++++++++++ 18 files changed, 199 insertions(+), 23 deletions(-) create mode 100644 assets/images/desktop/ui/tab.png create mode 100644 assets/images/desktop/ui/tabBody.png create mode 100644 assets/images/desktop/ui/tabHover.png create mode 100644 assets/images/desktop/ui/tabNonSelected.png create mode 100644 assets/images/desktop/ui/tabPressed.png create mode 100644 source/funkin/desktop/sprites/TabView.hx 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 a178e6c7765970553a2608a7d5f2346274c254a8..28f0f77da9f7adfc973152700dcfd80b27f54efc 100644 GIT binary patch delta 196 zcmV;#06YJI0`&oqIe(`~L_t(|+SSiF5`s_=gkk0^0t$z~rPN47PU=PkmfIl&0nhT_ zJ!dFmX#@YLqpzw-DP`%1=smuyb;vjx)Y#+I%d`9e8C0viu}{>1ISBLwENTomvVR3W zLEx|hD-h@~Sb{)TzzPI99aw@um%$nY+5)Bt23)Qf%s}8mz&+Cu1I|MR&j$=RTQhh8 yfl~pmdki><7`*K;;CRE}eTxBu_-`&lG_C=*SYiF&`u<`7000005AXb0f7RLIe)WBL_t(|+O^d;62d?bL{ZIIkc7Dcg;N0${-F3sP}t%M7)hLE zVU`&cG23+1(MvxWV>})aea?@2J7gUO8M{86Jg-t9i?ZsBeWMn9ZjK0000< KMNUMnLSTX{D^ZaE diff --git a/assets/images/desktop/ui/tab.png b/assets/images/desktop/ui/tab.png new file mode 100644 index 0000000000000000000000000000000000000000..265deb76043f372cb72450788215fbf7d72d079f GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz8!3HF`W%CyUDb50q$YKTtzQZ8Qcszea3Q*9` z)5S5Q;#TsX|NrfoISh=9oFr117FhNq6g#jr@%;Yq@UX5IkBERk0J9{Q(bS~F6L@7! z3$7e^nEl}G?d{tG4m*T~hRzRUcITBbogl%?sB@s|ug2mdmw_fTc)I$ztaD0e0su)7 BFV+A6 literal 0 HcmV?d00001 diff --git a/assets/images/desktop/ui/tabBody.png b/assets/images/desktop/ui/tabBody.png new file mode 100644 index 0000000000000000000000000000000000000000..ced1caa0b05c1d6e590dce88a785f4c1a7c8b221 GIT binary patch literal 141 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz8!3HF`W%CyUDb50q$YKTtzQZ8Qcszea3Q*AA z)5S5Q;?~%>^ecG=`eA%A6RgSP??(SC4VD~VSah;@EH>4%+BrVhz^pCs!XTo_ zA^ZRriQaA_0>EUof3QA p8a${t{Ghg*vH3^7p0mk1#%&RafA9bLmjrY&gQu&X%Q~loCIIMeT8;n! literal 0 HcmV?d00001 diff --git a/assets/images/desktop/ui/tabNonSelected.png b/assets/images/desktop/ui/tabNonSelected.png new file mode 100644 index 0000000000000000000000000000000000000000..b644b3f531349a5be73f43fad2c9274bdcc80fed GIT binary patch literal 160 zcmeAS@N?(olHy`uVBq!ia0vp^B0wz8!3HF`W%CyUDb50q$YKTtzQZ8Qcszea3Q#b} z)5S5Q;#TsX|NrfoO&OKX@}#7sEIE;~z_O=+*|AO5uI7iBD%-7Fw^lXsu+H?_n0TVC zPs$?e!2&}Ad;5BBQ=T~%g^SLwXk5(3C&j!nQG$noAt|uv=UMC5dO*_|JYD@<);T3K F0RVz8F_-`V literal 0 HcmV?d00001 diff --git a/assets/images/desktop/ui/tabPressed.png b/assets/images/desktop/ui/tabPressed.png new file mode 100644 index 0000000000000000000000000000000000000000..113d5f7e4c6d8b47c48602fe702e45cc329004c7 GIT binary patch literal 442 zcmV;r0Y(0aP)pGY)M2xRCwCe)VodsK^O(#vp_UT*o&Qncd)Ut<6SHiG_k?RWf8d= zY)lmJZRn_Y3tp0j<4k$y-pTe@X8*+ zv@$TPG_?%|y6zf$J^`D*;<0h!gN51{hH(hpOe@{bVH0pZ#Y64b2d{6V0lRksys3_% z6KE)coIr=b`?>&&HZ?Q}G!#Kj4cQc(h5$>IXux(;fR&1W!%!goa#MnKc?>fo$Ovq- z1XwNk4NXOmiH7yI01KA{>NJ~_;%pWKI<&(lxx{$Ovo>0W*%}{Z80?NdN!<07*qoM6N<$g7GN8w*UYD literal 0 HcmV?d00001 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