diff options
Diffstat (limited to 'src/main/java/cc/polyfrost')
11 files changed, 124 insertions, 98 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java index db2ea8b..867fdbc 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java @@ -29,6 +29,7 @@ package cc.polyfrost.oneconfig.gui; import cc.polyfrost.oneconfig.config.core.OneColor; import cc.polyfrost.oneconfig.gui.animations.Animation; import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad; +import cc.polyfrost.oneconfig.gui.animations.EaseOutExpo; import cc.polyfrost.oneconfig.gui.elements.BasicElement; import cc.polyfrost.oneconfig.gui.elements.ColorSelector; import cc.polyfrost.oneconfig.gui.elements.text.TextInputField; @@ -60,8 +61,8 @@ public class OneConfigGui extends OneUIScreen { 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, new ColorPalette(Colors.GRAY_700, Colors.GRAY_500, Colors.GRAY_500_80), true); - private final BasicElement forwardArrow = new BasicElement(40, 40, new ColorPalette(Colors.GRAY_700, Colors.GRAY_500, Colors.GRAY_500_80), true); + private final BasicElement backArrow = new BasicElement(40, 40, ColorPalette.TERTIARY, true); + private final BasicElement forwardArrow = new BasicElement(40, 40, ColorPalette.TERTIARY, true); public ColorSelector currentColorSelector; public boolean allowClose = true; protected Page currentPage; @@ -83,7 +84,6 @@ public class OneConfigGui extends OneUIScreen { @Override public void draw(long vg, float partialTicks, InputHandler inputHandler) { - long start = System.nanoTime(); if (currentPage == null) { currentPage = new ModsPage(); currentPage.parents.add(currentPage); @@ -98,7 +98,7 @@ public class OneConfigGui extends OneUIScreen { RenderManager.scale(vg, scale, scale); inputHandler.scale(scale, scale); - RenderManager.drawDropShadow(vg, x, y, 1280, 800, 32, 0, 20); + RenderManager.drawDropShadow(vg, x, y, 1280, 800, 64, 0, 20); RenderManager.drawRoundedRect(vg, x + 224, y, 1056, 800, Colors.GRAY_800, 20f); RenderManager.drawRoundedRect(vg, x, y, 244, 800, Colors.GRAY_800_95, 20f); RenderManager.drawRect(vg, x + 224, y, 20, 800, Colors.GRAY_800); @@ -107,14 +107,12 @@ public class OneConfigGui extends OneUIScreen { RenderManager.drawLine(vg, x + 224, y + 72, x + 1280, y + 72, 1, Colors.GRAY_700); RenderManager.drawLine(vg, x + 224, y, x + 222, y + 800, 1, Colors.GRAY_700); - RenderManager.drawSvg(vg, SVGs.ONECONFIG, x + 19, y + 19, 42, 42); - RenderManager.drawText(vg, "OneConfig", x + 69, y + 32, -1, 18f, Fonts.BOLD); // added half line height to center text - RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, -1, 12f, Fonts.REGULAR); + RenderManager.drawSvg(vg, SVGs.ONECONFIG_FULL_DARK, x + 33f, y + 22f, 158f, 34f); textInputField.draw(vg, x + 1020, y + 16, inputHandler); sideBar.draw(vg, x, y, inputHandler); - backArrow.draw(vg, x + 240, y + 16, inputHandler); - forwardArrow.draw(vg, x + 288, y + 16, inputHandler); + backArrow.update(x + 240, y + 16, inputHandler); + forwardArrow.update(x + 280, y + 16, inputHandler); if (previousPages.size() == 0) { backArrow.disable(true); @@ -124,7 +122,7 @@ public class OneConfigGui extends OneUIScreen { if (!backArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); } - RenderManager.drawSvg(vg, SVGs.CARET_LEFT, x + 246, y + 22, 28, 28); + RenderManager.drawSvg(vg, SVGs.ARROW_LEFT, x + 250, y + 26, 20, 20, backArrow.currentColor); RenderManager.setAlpha(vg, 1f); if (nextPages.size() == 0) { forwardArrow.disable(true); @@ -134,7 +132,7 @@ public class OneConfigGui extends OneUIScreen { if (!forwardArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f); } - RenderManager.drawSvg(vg, SVGs.CARET_RIGHT, x + 294, y + 22, 28, 28); + RenderManager.drawSvg(vg, SVGs.ARROW_RIGHT, x + 290, y + 26, 20, 20, forwardArrow.currentColor); RenderManager.setAlpha(vg, 1f); if (backArrow.isClicked() && previousPages.size() > 0) { @@ -147,7 +145,7 @@ public class OneConfigGui extends OneUIScreen { } else if (forwardArrow.isClicked() && nextPages.size() > 0) { try { previousPages.add(0, currentPage); - openPage(nextPages.get(0), new EaseInOutQuad(300, 224, 2128, true), false); + openPage(nextPages.get(0), new EaseOutExpo(300, 224, 2128, true), false); nextPages.remove(0); } catch (Exception ignored) { } @@ -173,7 +171,7 @@ public class OneConfigGui extends OneUIScreen { ScissorManager.clearScissors(vg); inputHandler.stopBlock(blockedClicks); - float breadcrumbX = x + 352; + float breadcrumbX = x + 336; for (int i = 0; i < currentPage.parents.size(); i++) { String title = currentPage.parents.get(i).getTitle(); float width = RenderManager.getTextWidth(vg, title, 24f, Fonts.SEMIBOLD); @@ -188,9 +186,6 @@ public class OneConfigGui extends OneUIScreen { breadcrumbX += width + 32; } - long end = System.nanoTime() - start; - String s = (" draw: " + end / 1000000f + "ms"); - RenderManager.drawText(vg, s, x + 1170, y + 792, Colors.GRAY_300, 10f, Fonts.MEDIUM); if (currentColorSelector != null) { currentColorSelector.draw(vg); } @@ -215,7 +210,7 @@ public class OneConfigGui extends OneUIScreen { } public void openPage(@NotNull Page page, boolean addToPrevious) { - openPage(page, new EaseInOutQuad(300, 224, 2128, false), addToPrevious); + openPage(page, new EaseOutExpo(300, 224, 2128, false), addToPrevious); } public void openPage(@NotNull Page page, Animation animation, boolean addToPrevious) { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java index bd0503c..cdcc571 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java @@ -29,6 +29,7 @@ package cc.polyfrost.oneconfig.gui; import cc.polyfrost.oneconfig.gui.animations.Animation; import cc.polyfrost.oneconfig.gui.animations.CubicBezier; import cc.polyfrost.oneconfig.gui.animations.DummyAnimation; +import cc.polyfrost.oneconfig.gui.animations.EaseOutExpo; import cc.polyfrost.oneconfig.gui.elements.BasicButton; import cc.polyfrost.oneconfig.gui.pages.CreditsPage; import cc.polyfrost.oneconfig.gui.pages.ModConfigPage; @@ -37,6 +38,9 @@ import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.internal.assets.SVGs; import cc.polyfrost.oneconfig.internal.config.Preferences; import cc.polyfrost.oneconfig.internal.gui.HudGui; +import cc.polyfrost.oneconfig.libs.universal.UMinecraft; +import cc.polyfrost.oneconfig.libs.universal.wrappers.UPlayer; +import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent; import cc.polyfrost.oneconfig.renderer.RenderManager; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.utils.InputHandler; @@ -50,29 +54,31 @@ import static cc.polyfrost.oneconfig.gui.elements.BasicButton.SIZE_36; public class SideBar { private final ArrayList<BasicButton> buttons = new ArrayList<BasicButton>() {{ - add(new BasicButton(192, SIZE_36, "Credits", SVGs.COPYRIGHT_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Global Search", SVGs.MAGNIFYING_GLASS_BOLD, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Mods", SVGs.FADERS_HORIZONTAL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.PRIMARY)); - add(new BasicButton(192, SIZE_36, "Profiles", SVGs.USER_SWITCH_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Performance", SVGs.GAUGE_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Updates", SVGs.ARROWS_CLOCKWISE_BOLD, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Themes", SVGs.PAINT_BRUSH_BROAD_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Screenshots", SVGs.APERTURE_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); - add(new BasicButton(192, SIZE_36, "Preferences", SVGs.GEAR_SIX_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + int width = 192; + add(new BasicButton(width, SIZE_36, "Credits", SVGs.COPYRIGHT_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + + add(new BasicButton(width, SIZE_36, "Mods", SVGs.FADERS_HORIZONTAL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.PRIMARY)); + add(new BasicButton(width, SIZE_36, "Profiles", SVGs.USER_SWITCH_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + add(new BasicButton(width, SIZE_36, "Performance", SVGs.GAUGE_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + + add(new BasicButton(width, SIZE_36, "Themes", SVGs.PAINT_BRUSH_BROAD_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + add(new BasicButton(width, SIZE_36, "Screenshots", SVGs.APERTURE_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); + add(new BasicButton(width, SIZE_36, "Preferences", SVGs.GEAR_SIX_FILL, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY)); }}; - private final BasicButton HUDButton = new BasicButton(192, SIZE_36, "Edit HUD", SVGs.NOTE_PENCIL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY); - private final BasicButton CloseButton = new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE_BOLD, null, ALIGNMENT_LEFT, ColorPalette.SECONDARY_DESTRUCTIVE); + private final BasicButton hudButton = new BasicButton(192, SIZE_36, "Edit HUD", SVGs.NOTE_PENCIL_BOLD, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY); + private final BasicButton closeButton = new BasicButton(192, SIZE_36, "Close", SVGs.X_CIRCLE_BOLD, null, ALIGNMENT_LEFT, ColorPalette.TERTIARY_DESTRUCTIVE); private int selected = 2; private Animation moveAnimation = null; private Animation sizeAnimation = null; private int y; + private int sidebarY; public SideBar() { buttons.get(0).setClickAction(new CreditsPage()); - buttons.get(2).setClickAction(new ModsPage()); - buttons.get(8).setClickAction(new ModConfigPage(Preferences.getInstance().mod.defaultPage, true)); - HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); - CloseButton.setClickAction(GuiUtils::closeScreen); + buttons.get(1).setClickAction(new ModsPage()); + buttons.get(6).setClickAction(new ModConfigPage(Preferences.getInstance().mod.defaultPage, true)); + hudButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui())); + closeButton.setClickAction(GuiUtils::closeScreen); for (BasicButton button : buttons) { if (button.hasClickAction()) continue; button.disable(true); @@ -95,19 +101,24 @@ public class SideBar { } } - buttons.get(0).draw(vg, x + 16, y + 80, inputHandler); - buttons.get(1).draw(vg, x + 16, y + 116, inputHandler); - RenderManager.drawText(vg, "MOD CONFIG", x + 16, y + 178, Colors.WHITE, 12, Fonts.SEMIBOLD); - buttons.get(2).draw(vg, x + 16, y + 192, inputHandler); - buttons.get(3).draw(vg, x + 16, y + 228, inputHandler); - buttons.get(4).draw(vg, x + 16, y + 264, inputHandler); - buttons.get(5).draw(vg, x + 16, y + 300, inputHandler); - RenderManager.drawText(vg, "PERSONALIZATION", x + 16, y + 362, Colors.WHITE, 12, Fonts.SEMIBOLD); - buttons.get(6).draw(vg, x + 16, y + 376, inputHandler); - buttons.get(7).draw(vg, x + 16, y + 412, inputHandler); - buttons.get(8).draw(vg, x + 16, y + 448, inputHandler); - HUDButton.draw(vg, x + 16, y + 704, inputHandler); - CloseButton.draw(vg, x + 16, y + 748, inputHandler); + sidebarY = y + 44; + buttons.get(0).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); +// buttons.get(1).draw(vg, x + 16, y + 116, inputHandler); + RenderManager.drawText(vg, "MOD CONFIG", x + 16, calcAndIncrementLn(sidebarY + 26), Colors.WHITE_50, 12, Fonts.SEMIBOLD); + sidebarY = sidebarY - 26; + buttons.get(1).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); + buttons.get(2).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); + buttons.get(3).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); +// buttons.get(5).draw(vg, x + 16, listNewLn(sidebarY), inputHandler); + RenderManager.drawText(vg, "PERSONALIZATION", x + 16, calcAndIncrementLn(sidebarY + 26), Colors.WHITE_50, 12, Fonts.SEMIBOLD); + sidebarY = sidebarY - 26; + buttons.get(4).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); + buttons.get(5).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); + buttons.get(6).draw(vg, x + 16, calcAndIncrementLn(sidebarY), inputHandler); + sidebarY = 0; + + hudButton.draw(vg, x + 16, y + 704, inputHandler); + closeButton.draw(vg, x + 16, y + 748, inputHandler); } public void pageOpened(String page) { @@ -121,8 +132,14 @@ public class SideBar { private void moveSideBar(BasicButton button) { if (button.equals(buttons.get(selected))) return; buttons.get(selected).setColorPalette(ColorPalette.TERTIARY); - moveAnimation = new CubicBezier(0.76f, 0, 0.24f, 1, 300, buttons.get(selected).y - y, button.y - y, false); + moveAnimation = new EaseOutExpo(300, buttons.get(selected).y - y, button.y - y, false); sizeAnimation = new DummyAnimation(36); selected = buttons.indexOf(button); } + + // Utils + private int calcAndIncrementLn(int n) { + sidebarY = n + 36; + return sidebarY; + } } diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutBump.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutBump.java new file mode 100644 index 0000000..44fd56e --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutBump.java @@ -0,0 +1,23 @@ +package cc.polyfrost.oneconfig.gui.animations; + +public class EaseOutBump extends Animation { + private static final double CONSTANT_1 = 1.7; + private static final double CONSTANT_2 = 2.7; + + /** + * @param duration The duration of the animation + * @param start The start of the animation + * @param end The end of the animation + * @param reverse Reverse the animation + */ + public EaseOutBump(int duration, float start, float end, boolean reverse) { + super(duration, start, end, reverse); + } + + // Courtesy of https://easings.net/ + @Override + protected float animate(float x) { + // return x == 0 ? 0 : (float) (x == 1 ? 1 : Math.pow(2, -0.5 * x) * Math.sin((x * 100 - 2) * c4) + 1); + return (float) (1 + CONSTANT_2 * Math.pow(x-1, 3) + CONSTANT_1 * 1.2 * Math.pow(x-1, 2)); + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutExpo.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutExpo.java new file mode 100644 index 0000000..0f4cb68 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseOutExpo.java @@ -0,0 +1,20 @@ +package cc.polyfrost.oneconfig.gui.animations; + +public class EaseOutExpo extends Animation { + + /** + * @param duration The duration of the animation + * @param start The start of the animation + * @param end The end of the animation + * @param reverse Reverse the animation + */ + public EaseOutExpo(int duration, float start, float end, boolean reverse) { + super(duration, start, end, reverse); + } + + // Courtesy of https://easings.net/ + @Override + protected float animate(float x) { + return x == 1 ? 1 : 1 - (float) Math.pow(2, -10 * x); + } +} 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 d93445b..1c220d9 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -271,8 +271,8 @@ public class ColorSelector { private void doDrag() { if (inputHandler.isAreaHovered(x, y, 368, 64) && Platform.getMousePlatform().isButtonDown(0) && !dragging) { - float dx = (float) (Platform.getMousePlatform().getMouseDX() / (OneConfigGui.INSTANCE == null ? 1 : OneConfigGui.INSTANCE.getScaleFactor())); - float dy = (float) (Platform.getMousePlatform().getMouseDY() / (OneConfigGui.INSTANCE == null ? 1 : OneConfigGui.INSTANCE.getScaleFactor())); + float dx = (float) (Platform.getMousePlatform().getMouseDX() / (OneConfigGui.INSTANCE == null ? 1 : OneConfigGui.getScaleFactor())); + float dy = (float) (Platform.getMousePlatform().getMouseDY() / (OneConfigGui.INSTANCE == null ? 1 : OneConfigGui.getScaleFactor())); x += dx; mouseX += dx; y -= dy; diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java index 102eab3..d3ad0b7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java @@ -27,11 +27,9 @@ package cc.polyfrost.oneconfig.gui.elements.config; import cc.polyfrost.oneconfig.config.annotations.DualOption; +import cc.polyfrost.oneconfig.gui.animations.*; import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.config.elements.BasicOption; -import cc.polyfrost.oneconfig.gui.animations.Animation; -import cc.polyfrost.oneconfig.gui.animations.DummyAnimation; -import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic; import cc.polyfrost.oneconfig.renderer.RenderManager; import cc.polyfrost.oneconfig.renderer.font.Fonts; import cc.polyfrost.oneconfig.utils.InputHandler; @@ -81,7 +79,7 @@ public class ConfigDualOption extends BasicOption { RenderManager.setAlpha(vg, 1); if ((hoveredLeft && toggled || hoveredRight && !toggled) && inputHandler.isClicked()) { toggled = !toggled; - posAnimation = new EaseInOutCubic(175, 228, 356, !toggled); + posAnimation = new EaseOutExpo(300, 228, 356, !toggled); try { set(toggled); } catch (IllegalAccessException e) { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java index a62afb7..de6b786 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java @@ -27,12 +27,9 @@ package cc.polyfrost.oneconfig.gui.elements.config; import cc.polyfrost.oneconfig.config.annotations.Switch; +import cc.polyfrost.oneconfig.gui.animations.*; import cc.polyfrost.oneconfig.internal.assets.Colors; import cc.polyfrost.oneconfig.config.elements.BasicOption; -import cc.polyfrost.oneconfig.gui.animations.Animation; -import cc.polyfrost.oneconfig.gui.animations.ColorAnimation; -import cc.polyfrost.oneconfig.gui.animations.DummyAnimation; -import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad; import cc.polyfrost.oneconfig.platform.Platform; import cc.polyfrost.oneconfig.renderer.RenderManager; import cc.polyfrost.oneconfig.renderer.font.Fonts; @@ -75,7 +72,7 @@ public class ConfigSwitch extends BasicOption { if (inputHandler.isAreaClicked(x, y, 42, 32) && isEnabled()) { toggled = !toggled; - animation = new EaseInOutQuad(200, 0, 1, !toggled); + animation = new EaseOutBump(200, 0, 1, !toggled); color.setPalette(toggled ? ColorPalette.PRIMARY : ColorPalette.SECONDARY); try { set(toggled); 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 89e2d9d..02cfc83 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java @@ -38,10 +38,8 @@ public class CreditsPage extends Page { @Override public void draw(long vg, int x, int y, InputHandler inputHandler) { - RenderManager.drawSvg(vg, SVGs.ONECONFIG, x + 20f, y + 20f, 96, 96); - RenderManager.drawText(vg, "OneConfig", x + 130, y + 46, -1, 42, Fonts.BOLD); - RenderManager.drawText(vg, "ALPHA - By Polyfrost", x + 132, y + 76, -1, 18, Fonts.MEDIUM); - RenderManager.drawText(vg, "v0.1", x + 132, y + 96, -1, 18, Fonts.MEDIUM); + RenderManager.drawSvg(vg, SVGs.ONECONFIG_FULL_DARK, x + 15f, y + 20f, 474, 102); + y -= 32; RenderManager.drawText(vg, "Development Team", x + 20, y + 180, -1, 24, Fonts.SEMIBOLD); RenderManager.drawText(vg, " - MoonTidez - Founder and lead designer", x + 20, y + 205, -1, 12, Fonts.REGULAR); @@ -49,6 +47,7 @@ public class CreditsPage extends Page { RenderManager.drawText(vg, " - nextdaydelivery - GUI frontend, Render Manager, Utilities", x + 20, y + 235, -1, 12, Fonts.REGULAR); RenderManager.drawText(vg, " - Wyvest - Gradle, Render Manager, VCAL, Utilities", x + 20, y + 250, -1, 12, Fonts.REGULAR); RenderManager.drawText(vg, " - Pauline - Utilities", x + 20, y + 265, -1, 12, Fonts.REGULAR); + RenderManager.drawText(vg, " - Caledonian - Designer", x + 20, y + 280, -1, 12, Fonts.REGULAR); RenderManager.drawText(vg, "Libraries", x + 20, y + 318, -1, 24, Fonts.SEMIBOLD); RenderManager.drawText(vg, " - LWJGLTwoPointFive (DJTheRedstoner) - LWJGL3 loading hack", x + 20, y + 340, -1, 12, Fonts.REGULAR); diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java b/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java index 5ccf384..a65c847 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/assets/SVGs.java @@ -36,8 +36,7 @@ import cc.polyfrost.oneconfig.renderer.SVG; * @see AssetLoader */ public class SVGs { - public static final SVG ONECONFIG = new SVG("/assets/oneconfig/icons/OneConfig.svg"); - public static final SVG ONECONFIG_OFF = new SVG("/assets/oneconfig/icons/OneConfigOff.svg"); + public static final SVG ONECONFIG_FULL_DARK = new SVG("/assets/oneconfig/icons/OneConfigFullDark.svg"); public static final SVG COPYRIGHT_FILL = new SVG("/assets/oneconfig/icons/CopyrightFill.svg"); public static final SVG APERTURE_FILL = new SVG("/assets/oneconfig/icons/ApertureFill.svg"); public static final SVG ARROWS_CLOCKWISE_BOLD = new SVG("/assets/oneconfig/icons/ArrowsClockwiseBold.svg"); @@ -51,6 +50,8 @@ public class SVGs { public static final SVG X_CIRCLE_BOLD = new SVG("/assets/oneconfig/icons/XCircleBold.svg"); public static final SVG CARET_LEFT = new SVG("/assets/oneconfig/icons/CaretLeftBold.svg"); public static final SVG CARET_RIGHT = new SVG("/assets/oneconfig/icons/CaretRightBold.svg"); + public static final SVG ARROW_LEFT = new SVG("/assets/oneconfig/icons/ArrowLeft.svg"); + public static final SVG ARROW_RIGHT = new SVG("/assets/oneconfig/icons/ArrowRight.svg"); public static final SVG INFO_ARROW = new SVG("/assets/oneconfig/icons/InfoArrow.svg"); // OLD ICONS diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java index 4d54621..2e78e6f 100644 --- a/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/RenderManager.java @@ -621,10 +621,6 @@ public final class RenderManager { public static void drawSvg(long vg, String filePath, float x, float y, float width, float height, float scale) { float w = width * scale; float h = height * scale; - if (OneConfigGui.INSTANCE != null && OneConfigGui.isOpen()) { - w *= OneConfigGui.INSTANCE.getScaleFactor(); - h *= OneConfigGui.INSTANCE.getScaleFactor(); - } if (AssetLoader.INSTANCE.loadSVG(vg, filePath, w, h)) { NVGPaint imagePaint = NVGPaint.calloc(); int image = AssetLoader.INSTANCE.getSVG(filePath, w, h); @@ -648,11 +644,8 @@ public final class RenderManager { * @param height The height. */ public static void drawSvg(long vg, String filePath, float x, float y, float width, float height) { - float scale = 1; - if (OneConfigGui.isOpen()) { - scale = OneConfigGui.getScaleFactor(); - } - drawSvg(vg, filePath, x, y, width, height, scale); + if (OneConfigGui.isOpen()) drawSvg(vg, filePath, x, y, width, height, OneConfigGui.getScaleFactor()); + else drawSvg(vg, filePath, x, y, width, height, 1f); } /** @@ -695,11 +688,8 @@ public final class RenderManager { * @param color The color. */ public static void drawSvg(long vg, String filePath, float x, float y, float width, float height, int color) { - float scale = 1; - if (OneConfigGui.isOpen()) { - scale = OneConfigGui.getScaleFactor(); - } - drawSvg(vg, filePath, x, y, width, height, color, scale); + if (OneConfigGui.isOpen()) drawSvg(vg, filePath, x, y, width, height, color, OneConfigGui.getScaleFactor()); + else drawSvg(vg, filePath, x, y, width, height, color, 1f); } /** @@ -708,11 +698,7 @@ public final class RenderManager { * @see RenderManager#drawSvg(long, String, float, float, float, float) */ public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height, float scale) { - float w = width * scale; - float h = height * scale; - if (AssetLoader.INSTANCE.loadSVG(vg, svg, w, h)) { - drawSvg(vg, svg.filePath, x, y, width, height); - } + drawSvg(vg, svg.filePath, x, y, width, height, scale); } /** @@ -721,11 +707,7 @@ public final class RenderManager { * @see RenderManager#drawSvg(long, String, float, float, float, float) */ public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height) { - float scale = 1; - if (OneConfigGui.isOpen()) { - scale = OneConfigGui.getScaleFactor(); - } - drawSvg(vg, svg, x, y, width, height, scale); + drawSvg(vg, svg.filePath, x, y, width, height); } /** @@ -734,11 +716,7 @@ public final class RenderManager { * @see RenderManager#drawSvg(long, String, float, float, float, float, int) */ public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height, int color, float scale) { - float w = width * scale; - float h = height * scale; - if (AssetLoader.INSTANCE.loadSVG(vg, svg, w, h)) { - drawSvg(vg, svg.filePath, x, y, width, height, color); - } + drawSvg(vg, svg.filePath, x, y, width, height, color, scale); } /** @@ -747,15 +725,12 @@ public final class RenderManager { * @see RenderManager#drawSvg(long, String, float, float, float, float) */ public static void drawSvg(long vg, SVG svg, float x, float y, float width, float height, int color) { - float scale = 1; - if (OneConfigGui.isOpen()) { - scale = OneConfigGui.getScaleFactor(); - } - drawSvg(vg, svg, x, y, width, height, color, scale); + if (OneConfigGui.isOpen()) drawSvg(vg, svg, x, y, width, height, color, OneConfigGui.getScaleFactor()); + else drawSvg(vg, svg, x, y, width, height, color, 1f); } /** - * Draw a circle with an info icon inside of it + * Draw a circle with an info icon inside it * * @param vg The NanoVG context. * @param type The icon type. diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/Notifications.java b/src/main/java/cc/polyfrost/oneconfig/utils/Notifications.java index 2e64040..5ce15d4 100644 --- a/src/main/java/cc/polyfrost/oneconfig/utils/Notifications.java +++ b/src/main/java/cc/polyfrost/oneconfig/utils/Notifications.java @@ -226,6 +226,7 @@ public final class Notifications { @Subscribe private void onHudRender(HudRenderEvent event) { + if (notifications.size() == 0) return; RenderManager.setupAndDraw((vg) -> { float desiredPosition = -16f; float scale = OneConfigGui.getScaleFactor(); |