diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-30 17:47:02 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-30 17:47:02 +0200 |
commit | 092494fd1226aa129ea88aba60fe9d6a5bf2c40e (patch) | |
tree | 1ba473dbe6bb8b8b92df9cde2de632017560a3b2 /src/main/java/cc/polyfrost/oneconfig/gui | |
parent | b745fa5c04a421cc8d8979b2e4cbf6288dc4684a (diff) | |
download | OneConfig-092494fd1226aa129ea88aba60fe9d6a5bf2c40e.tar.gz OneConfig-092494fd1226aa129ea88aba60fe9d6a5bf2c40e.tar.bz2 OneConfig-092494fd1226aa129ea88aba60fe9d6a5bf2c40e.zip |
new sidebar, now animations
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
6 files changed, 60 insertions, 85 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index 75e6750..be473f9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.gui.elements.BasicElement; import cc.polyfrost.oneconfig.gui.elements.ColorSelector; import cc.polyfrost.oneconfig.gui.elements.text.TextInputField; import cc.polyfrost.oneconfig.gui.pages.HomePage; +import cc.polyfrost.oneconfig.gui.pages.ModsPage; import cc.polyfrost.oneconfig.gui.pages.Page; import cc.polyfrost.oneconfig.libs.universal.*; import cc.polyfrost.oneconfig.lwjgl.RenderManager; @@ -26,7 +27,7 @@ public class OneConfigGui extends UScreen { protected Page currentPage; protected Page prevPage; private float pageProgress = -224f; - private final TextInputField textInputField = new TextInputField(248, 40, "Search...", false, false, SVGs.SEARCH); + private final TextInputField textInputField = new TextInputField(248, 40, "Search...", false, false, SVGs.MAGNIFYING_GLASS_BOLD); private final ArrayList<Page> previousPages = new ArrayList<>(); private final ArrayList<Page> nextPages = new ArrayList<>(); private final BasicElement backArrow = new BasicElement(40, 40, -1, false); @@ -68,7 +69,7 @@ public class OneConfigGui extends UScreen { int y2 = 0; RenderManager.setupAndDraw((vg) -> { if (currentPage == null) { - currentPage = new HomePage(); + currentPage = new ModsPage(); parents.add(currentPage); } if (time == -1) time = UMinecraft.getTime(); @@ -94,7 +95,7 @@ public class OneConfigGui extends UScreen { RenderManager.drawSvg(vg, SVGs.ONECONFIG, x + 19, y + 19, 42, 42); RenderManager.drawText(vg, "OneConfig", x + 69, y + 32, OneConfigConfig.WHITE, 18f, Fonts.BOLD); // added half line height to center text - RenderManager.drawText(vg, "ALPHA - By Polyfrost", x + 69, y + 51, OneConfigConfig.WHITE, 12f, Fonts.REGULAR); + RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, OneConfigConfig.WHITE, 12f, Fonts.REGULAR); textInputField.draw(vg, x + 1020, y + 16); sideBar.draw(vg, x, y); diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index a17076b..6f474c7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -1,77 +1,51 @@ package cc.polyfrost.oneconfig.gui; -import cc.polyfrost.oneconfig.config.OneConfigConfig; import cc.polyfrost.oneconfig.gui.elements.BasicButton; -import cc.polyfrost.oneconfig.gui.pages.HomePage; +import cc.polyfrost.oneconfig.gui.pages.CreditsPage; import cc.polyfrost.oneconfig.gui.pages.ModsPage; -import cc.polyfrost.oneconfig.lwjgl.RenderManager; -import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.SVGs; -import cc.polyfrost.oneconfig.utils.ColorUtils; import cc.polyfrost.oneconfig.utils.GuiUtils; -import cc.polyfrost.oneconfig.utils.MathUtils; import java.util.ArrayList; -import java.util.List; import static cc.polyfrost.oneconfig.gui.elements.BasicButton.ALIGNMENT_LEFT; import static cc.polyfrost.oneconfig.gui.elements.BasicButton.SIZE_36; +import static cc.polyfrost.oneconfig.utils.ColorUtils.*; public class SideBar { - private final List<BasicButton> btnList = new ArrayList<>(); - - private float targetY = 0, currentY = 0; + private final ArrayList<BasicButton> buttons = new ArrayList<BasicButton>() {{ + add(new BasicButton(192, SIZE_36, "Credits", SVGs.COPYRIGHT_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Global Search", SVGs.MAGNIFYING_GLASS_BOLD, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Mods", SVGs.FADERS_HORIZONTAL_BOLD, null, ALIGNMENT_LEFT, PRIMARY)); + add(new BasicButton(192, SIZE_36, "Profiles", SVGs.USER_SWITCH_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Performance", SVGs.GAUGE_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Updates", SVGs.ARROWS_CLOCKWISE_BOLD, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Themes", SVGs.PAINT_BRUSH_BROAD_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Screenshots", SVGs.APERTURE_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + add(new BasicButton(192, SIZE_36, "Preferences", SVGs.GEAR_SIX_FILL, null, ALIGNMENT_LEFT, TERTIARY)); + }}; + private final BasicButton HUDButton = new BasicButton(192, SIZE_36, "Edit HUD", SVGs.NOTE_PENCIL_BOLD, null, ALIGNMENT_LEFT, SECONDARY); + private final BasicButton CloseButton = new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE_BOLD, null, ALIGNMENT_LEFT, SECONDARY_DESTRUCTIVE); public SideBar() { - btnList.add(new BasicButton(192, SIZE_36, "Dashboard", SVGs.DASHBOARD, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.get(0).setClickAction(new HomePage()); - btnList.add(new BasicButton(192, SIZE_36, "Global Search", SVGs.SEARCH, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Screenshots", SVGs.IMAGE, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Preferences", SVGs.SETTINGS, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, 36, "Mods", SVGs.MODS, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.get(4).setClickAction(new ModsPage()); - btnList.add(new BasicButton(192, SIZE_36, "Performance", SVGs.PERFORMANCE, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Profiles", SVGs.PROFILES, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Updates", SVGs.UPDATE, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Themes Library", SVGs.THEME, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Themes Browser", SVGs.SEARCH, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Packs Library", SVGs.BOX, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Packs Browser", SVGs.SEARCH, null, ALIGNMENT_LEFT, ColorUtils.TERTIARY)); - btnList.add(new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT)); - btnList.get(12).setClickAction(() -> GuiUtils.displayScreen(null)); - btnList.add(new BasicButton(192, SIZE_36, "Minimize", SVGs.MINIMISE, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT)); - btnList.get(13).setClickAction(() -> GuiUtils.displayScreen(null)); - btnList.add(new BasicButton(192, SIZE_36, "Edit HUD", SVGs.HUD, null, ALIGNMENT_LEFT, ColorUtils.SECONDARY_TRANSPARENT)); - btnList.get(14).setClickAction(() -> GuiUtils.displayScreen(new HudGui())); + buttons.get(0).setClickAction(new CreditsPage()); + buttons.get(2).setClickAction(new ModsPage()); + HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); + CloseButton.setClickAction(GuiUtils::closeScreen); + for (BasicButton button : buttons) button.setToggleable(true); } public void draw(long vg, int x, int y) { - currentY = MathUtils.easeInOutCirc(50, currentY, targetY - currentY, 400); - RenderManager.drawRoundedRect(vg, x + 16, y + currentY, 192, 36, OneConfigConfig.PRIMARY_600, OneConfigConfig.CORNER_RADIUS); - int i = 0; - if (targetY == 0) { - targetY = 96; - currentY = targetY; - } - for (BasicButton btn : btnList) { - btn.draw(vg, x + 16, y + 96 + i); - if (i >= 562) i += 44; - else i += 36; - if (i == 144) { - RenderManager.drawText(vg, "MOD CONFIG", x + 16, y + 266, OneConfigConfig.WHITE_80, 12f, Fonts.SEMIBOLD); - i = 180; - } - if (i == 324) { - RenderManager.drawText(vg, "PERSONALIZATION", x + 16, y + 446, OneConfigConfig.WHITE_80, 12f, Fonts.SEMIBOLD); - i = 360; - } - if (i == 504) { - i = 562; - } - - if (btn.isClicked() && btn.getPage() != null) { - if (i < 520) targetY = btn.y - y; - } - } + buttons.get(0).draw(vg, x + 16, y + 80); + buttons.get(1).draw(vg, x + 16, y + 116); + buttons.get(2).draw(vg, x + 16, y + 192); + buttons.get(3).draw(vg, x + 16, y + 228); + buttons.get(4).draw(vg, x + 16, y + 264); + buttons.get(5).draw(vg, x + 16, y + 300); + buttons.get(6).draw(vg, x + 16, y + 376); + buttons.get(7).draw(vg, x + 16, y + 412); + buttons.get(8).draw(vg, x + 16, y + 448); + HUDButton.draw(vg, x + 16, y + 704); + CloseButton.draw(vg, x + 16, y + 748); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java index f97cde2..c2bda06 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java @@ -75,16 +75,16 @@ public class BasicButton extends BasicElement { this.y = y; RenderManager.drawRoundedRect(vg, x, y, this.width, this.height, currentColor, this.cornerRadius); float contentWidth = 0f; - int textColor = -1; + int color = -1; final float middle = x + width / 2f; final float middleYIcon = y + height / 2f - iconSize / 2f; final float middleYText = y + height / 2f + fontSize / 8f; if (this.text != null) { if (this.colorPalette == ColorUtils.TERTIARY) { - textColor = OneConfigConfig.WHITE_80; - if (hovered) textColor = OneConfigConfig.WHITE; - if (clicked) textColor = OneConfigConfig.WHITE_80; - if (page == null) textColor = OneConfigConfig.WHITE_50; + color = OneConfigConfig.WHITE_80; + if (hovered) color = OneConfigConfig.WHITE; + if (clicked) color = OneConfigConfig.WHITE_80; + if (page == null) color = OneConfigConfig.WHITE_50; } contentWidth += RenderManager.getTextWidth(vg, text, fontSize, Fonts.MEDIUM); } @@ -101,48 +101,48 @@ public class BasicButton extends BasicElement { contentWidth += iconSize + xSpacing; } if (text != null) { - RenderManager.drawText(vg, text, middle - contentWidth / 2 + (icon1 == null ? 0 : iconSize + xSpacing), middleYText, textColor, fontSize, Fonts.MEDIUM); + RenderManager.drawText(vg, text, middle - contentWidth / 2 + (icon1 == null ? 0 : iconSize + xSpacing), middleYText, color, fontSize, Fonts.MEDIUM); } if (icon1 != null) { - RenderManager.drawSvg(vg, icon1, middle - contentWidth / 2, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon1, middle - contentWidth / 2, middleYIcon, iconSize, iconSize, color); } if (icon2 != null) { - RenderManager.drawSvg(vg, icon2, middle + contentWidth / 2 - iconSize, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon2, middle + contentWidth / 2 - iconSize, middleYIcon, iconSize, iconSize, color); } this.update(x, y); return; } if (alignment == ALIGNMENT_JUSTIFIED) { if (text != null) { - RenderManager.drawText(vg, text, middle - contentWidth / 2, middleYText, textColor, fontSize, Fonts.MEDIUM); + RenderManager.drawText(vg, text, middle - contentWidth / 2, middleYText, color, fontSize, Fonts.MEDIUM); } if (icon1 != null) { - RenderManager.drawSvg(vg, icon1, x + xSpacing, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon1, x + xSpacing, middleYIcon, iconSize, iconSize, color); } if (icon2 != null) { - RenderManager.drawSvg(vg, icon2, x + width - xSpacing - iconSize, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon2, x + width - xSpacing - iconSize, middleYIcon, iconSize, iconSize, color); } this.update(x, y); return; } if (alignment == ALIGNMENT_LEFT) { - contentWidth = xSpacing; + contentWidth = xPadding; if (icon1 != null) { - RenderManager.drawSvg(vg, icon1, x + contentWidth, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon1, x + contentWidth, middleYIcon, iconSize, iconSize, color); contentWidth += iconSize + xSpacing; } if (text != null) { - RenderManager.drawText(vg, text, x + contentWidth, middleYText, textColor, fontSize, Fonts.MEDIUM); + RenderManager.drawText(vg, text, x + contentWidth, middleYText, color, fontSize, Fonts.MEDIUM); contentWidth += RenderManager.getTextWidth(vg, text, fontSize, Fonts.MEDIUM) + xSpacing; } if (icon2 != null) { - RenderManager.drawSvg(vg, icon2, x + contentWidth, middleYIcon, iconSize, iconSize); + RenderManager.drawSvg(vg, icon2, x + contentWidth, middleYIcon, iconSize, iconSize, color); } this.update(x, y); return; } if (alignment == ALIGNMENT_RIGHT) { - contentWidth = width - xSpacing; + contentWidth = width - xPadding; if (icon2 != null) { contentWidth -= iconSize; RenderManager.drawSvg(vg, icon2, x + contentWidth, middleYIcon, iconSize, iconSize); @@ -150,7 +150,7 @@ public class BasicButton extends BasicElement { } if (text != null) { contentWidth -= RenderManager.getTextWidth(vg, text, fontSize, Fonts.MEDIUM); - RenderManager.drawText(vg, text, x + contentWidth, middleYText, textColor, fontSize, Fonts.MEDIUM); + RenderManager.drawText(vg, text, x + contentWidth, middleYText, color, fontSize, Fonts.MEDIUM); contentWidth -= xSpacing; } if (icon1 != null) { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java index db97d5f..edd145e 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -106,7 +106,7 @@ public class ColorSelector { RenderManager.drawText(vg, "Color Selector", x + 16, y + 32, OneConfigConfig.WHITE_90, 18f, Fonts.SEMIBOLD); if (!closeBtn.isHovered()) RenderManager.setAlpha(vg, 0.8f); closeBtn.draw(vg, x + 368, y + 16); - RenderManager.drawSvg(vg, SVGs.X_CIRCLE, x + 368, y + 16, 32, 32, closeBtn.isHovered() ? OneConfigConfig.ERROR_600 : -1); + RenderManager.drawSvg(vg, SVGs.X_CIRCLE_BOLD, x + 368, y + 16, 32, 32, closeBtn.isHovered() ? OneConfigConfig.ERROR_600 : -1); RenderManager.setAlpha(vg, 1f); // hex parser diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java index 0bb94aa..218939c 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java @@ -5,7 +5,7 @@ import cc.polyfrost.oneconfig.lwjgl.font.Fonts; import cc.polyfrost.oneconfig.lwjgl.image.SVGs; public class CreditsPage extends Page { - CreditsPage() { + public CreditsPage() { super("Credits"); } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java index fd6e8fe..3e15e83 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java @@ -15,7 +15,7 @@ import cc.polyfrost.oneconfig.utils.NetworkUtils; import java.awt.*; public class HomePage extends Page { - private final BasicButton socialsBtn = new BasicButton(184, 36, "Socials", SVGs.SHARE, SVGs.POP_OUT, BasicButton.ALIGNMENT_CENTER, ColorUtils.PRIMARY); + /*private final BasicButton socialsBtn = new BasicButton(184, 36, "Socials", SVGs.SHARE, SVGs.POP_OUT, BasicButton.ALIGNMENT_CENTER, ColorUtils.PRIMARY); private final BasicButton discordBtn = new BasicButton(184, 36, "Discord", SVGs.WEBSITE, SVGs.LINK_DIAGONAL, BasicButton.ALIGNMENT_CENTER, ColorUtils.PRIMARY); private final BasicButton webBtn = new BasicButton(184, 36, "Website", SVGs.WEBSITE, null, BasicButton.ALIGNMENT_CENTER, ColorUtils.PRIMARY); private final BasicButton creditsBtn = new BasicButton(184, 36, "Credits", SVGs.AUDIO_PLAY, SVGs.LINK_DIAGONAL, BasicButton.ALIGNMENT_CENTER, ColorUtils.SECONDARY); @@ -27,16 +27,16 @@ public class HomePage extends Page { private final BasicButton button5 = new BasicButton(184, BasicButton.SIZE_36, "dhwuai", SVGs.MICROSOFT_ICON, SVGs.AUDIO_PLAY, BasicButton.ALIGNMENT_JUSTIFIED, 1); private final BasicButton button6 = new BasicButton(184, BasicButton.SIZE_32, "yes", SVGs.MICROSOFT_ICON, SVGs.AUDIO_PLAY, BasicButton.ALIGNMENT_RIGHT, 1); private final BasicButton button7 = new BasicButton(184, BasicButton.SIZE_32, "HELLO", SVGs.MICROSOFT_ICON, SVGs.AUDIO_PLAY, BasicButton.ALIGNMENT_CENTER, 1); - private final BasicButton button8 = new BasicButton(184, BasicButton.SIZE_40, "HELLO", SVGs.MICROSOFT_ICON, SVGs.AUDIO_PLAY, BasicButton.ALIGNMENT_CENTER, ColorUtils.SECONDARY_DESTRUCTIVE); + private final BasicButton button8 = new BasicButton(184, BasicButton.SIZE_40, "HELLO", SVGs.MICROSOFT_ICON, SVGs.AUDIO_PLAY, BasicButton.ALIGNMENT_CENTER, ColorUtils.SECONDARY_DESTRUCTIVE);*/ public HomePage() { super("Home Dashboard"); - socialsBtn.setClickAction(() -> NetworkUtils.browseLink("https://twitter.com/polyfrost")); + /*socialsBtn.setClickAction(() -> NetworkUtils.browseLink("https://twitter.com/polyfrost")); discordBtn.setClickAction(() -> NetworkUtils.browseLink("https://discord.gg/4BdUuGpMdf")); webBtn.setClickAction(() -> NetworkUtils.browseLink("https://polyfrost.cc")); creditsBtn.setClickAction(new CreditsPage()); - guideBtn.setClickAction(() -> NetworkUtils.browseLink("https://www.youtube.com/watch?v=dQw4w9WgXcQ")); + guideBtn.setClickAction(() -> NetworkUtils.browseLink("https://www.youtube.com/watch?v=dQw4w9WgXcQ"));*/ } @@ -50,7 +50,7 @@ public class HomePage extends Page { RenderManager.drawURL(vg, "https://www.youtube.com/watch?v=dQw4w9WgXcQ", x + 100, y + 205, 24, Fonts.MEDIUM); - discordBtn.draw(vg, x + 32, y + 658); + /*discordBtn.draw(vg, x + 32, y + 658); webBtn.draw(vg, x + 232, y + 658); socialsBtn.draw(vg, x + 432, y + 658); creditsBtn.draw(vg, x + 632, y + 658); @@ -66,7 +66,7 @@ public class HomePage extends Page { button5.draw(vg, x + 100, y + 600); button6.draw(vg, x + 350, y + 100); button7.draw(vg, x + 350, y + 300); - button8.draw(vg, x + 350, y + 450); + button8.draw(vg, x + 350, y + 450);*/ } @Override |