aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-05 17:43:23 +0200
committerGitHub <noreply@github.com>2022-06-05 17:43:23 +0200
commitab7256dff5d6d37488081ba7a01b36d3ee9ef563 (patch)
tree8207341e6c402848cdbe7b2f2297f5f975e0e083 /src/main/java/cc/polyfrost/oneconfig/gui
parenta903cfc4d3f76cf3db24749b65156d126fa714e7 (diff)
downloadOneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.gz
OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.tar.bz2
OneConfig-ab7256dff5d6d37488081ba7a01b36d3ee9ef563.zip
refactor (#36)
* refactor * fix vig compat * fix nanovg thingy * e * finalize * gui utils package thingy
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/Colors.java46
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java39
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java59
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModUpdateCard.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/Slider.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java18
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java42
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java18
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java12
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java16
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java12
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/SearchField.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java36
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java11
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java4
31 files changed, 272 insertions, 248 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/Colors.java b/src/main/java/cc/polyfrost/oneconfig/gui/Colors.java
new file mode 100644
index 0000000..6cb9567
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/Colors.java
@@ -0,0 +1,46 @@
+package cc.polyfrost.oneconfig.gui;
+
+import java.awt.*;
+
+public class Colors {
+ // the color library
+ public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent
+ public static final int BLACK = new Color(0, 0, 0, 255).getRGB(); // Black
+ public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900
+ public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB(); // Gray 900 80%
+ public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB(); // Gray 800
+ public static final int GRAY_800_95 = new Color(21, 22, 23, 242).getRGB();
+ public static final int GRAY_700 = new Color(34, 35, 38, 255).getRGB(); // Gray 700
+ public static final int GRAY_600 = new Color(42, 44, 48, 255).getRGB(); // Gray 600
+ public static final int GRAY_500 = new Color(49, 51, 56, 255).getRGB(); // Gray 500 // button sidebar hover, button gray normal
+ public static final int GRAY_500_80 = new Color(49, 51, 56, 204).getRGB(); // Gray 500 80% // button sidebar pressed
+ public static final int GRAY_400 = new Color(55, 59, 69, 255).getRGB(); // Gray 400
+ public static final int GRAY_300 = new Color(73, 79, 92, 255).getRGB(); // Gray 300 // button gray hover
+ public static final int GRAY_400_80 = new Color(55, 59, 69, 204).getRGB(); // Gray 400 80% // button gray pressed
+ public static final int PRIMARY_800 = new Color(13, 51, 128, 255).getRGB(); // Blue 800
+ public static final int PRIMARY_700 = new Color(18, 71, 178, 255).getRGB(); // Blue 700
+ public static final int PRIMARY_700_80 = new Color(18, 71, 178, 204).getRGB(); // Blue 700 80%
+ public static final int PRIMARY_600 = new Color(20, 82, 204, 255).getRGB(); // Blue 600 // button blue normal
+ public static final int PRIMARY_500 = new Color(25, 103, 255, 255).getRGB(); // Blue 500 // button blue hover
+ public static final int PRIMARY_400 = new Color(48, 129, 242, 255).getRGB();
+ public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB(); // White 60%
+ public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB(); // White 60%
+ public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB(); // White 80%
+ public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB(); // White 90%
+ public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 90%
+ public static final int WHITE = new Color(255, 255, 255, 255).getRGB(); // White 100%
+ public static final int SUCCESS_600 = new Color(3, 152, 85).getRGB();
+ public static final int SUCCESS_700 = new Color(2, 121, 72).getRGB();
+ public static final int WARNING_500 = new Color(247, 144, 9).getRGB();
+ public static final int WARNING_600 = new Color(220, 104, 3).getRGB();
+ public static final int ERROR_600_80 = new Color(217, 32, 32, 204).getRGB();
+ public static final int ERROR_600 = new Color(217, 32, 32).getRGB();
+ public static final int ERROR_700 = new Color(180, 24, 24).getRGB(); // Red 700
+ public static final int ERROR_800 = new Color(145, 24, 24).getRGB(); // Red 800
+ public static final int ERROR_800_80 = new Color(145, 24, 24, 204).getRGB(); // Red 800
+ public static final int ERROR_300 = new Color(253, 155, 155).getRGB();
+ public static final int ERROR_300_80 = new Color(253, 155, 155, 204).getRGB();
+ public static boolean ROUNDED_CORNERS = true;
+ public static final float CORNER_RADIUS_WIN = 20f;
+ public static final float CORNER_RADIUS = 12f;
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index 52030fc..1b172d0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -3,7 +3,7 @@ package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.hud.HudCore;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
import gg.essential.universal.UKeyboard;
import gg.essential.universal.UMatrixStack;
import gg.essential.universal.UScreen;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index a9da8c2..81fe9c0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -1,6 +1,5 @@
package cc.polyfrost.oneconfig.gui;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.gui.animations.Animation;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
@@ -9,11 +8,11 @@ import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.gui.pages.ModsPage;
import cc.polyfrost.oneconfig.gui.pages.Page;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
-import cc.polyfrost.oneconfig.utils.GuiUtils;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.image.SVGs;
+import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
+import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import gg.essential.universal.UKeyboard;
@@ -33,8 +32,8 @@ public class OneConfigGui extends UScreen {
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(OneConfigConfig.GRAY_700, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_500_80), true);
- private final BasicElement forwardArrow = new BasicElement(40, 40, new ColorPalette(OneConfigConfig.GRAY_700, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_500_80), true);
+ 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 ArrayList<Page> parents = new ArrayList<>();
public ColorSelector currentColorSelector;
public boolean mouseDown;
@@ -80,18 +79,18 @@ public class OneConfigGui extends UScreen {
int x = (int) ((UResolution.getWindowWidth() - 1280 * scale) / 2f / scale);
int y = (int) ((UResolution.getWindowHeight() - 800 * scale) / 2f / scale);
RenderManager.scale(vg, scale, scale);
- if (OneConfigConfig.ROUNDED_CORNERS) {
+ if (Colors.ROUNDED_CORNERS) {
RenderManager.drawDropShadow(vg, x, y, 1280, 800, 32, 0, 20);
- RenderManager.drawRoundedRect(vg, x + 224, y, 1056, 800, OneConfigConfig.GRAY_800, OneConfigConfig.CORNER_RADIUS_WIN);
- RenderManager.drawRoundedRect(vg, x, y, 244, 800, OneConfigConfig.GRAY_800_95, OneConfigConfig.CORNER_RADIUS_WIN);
- RenderManager.drawRect(vg, x + 224, y, 20, 800, OneConfigConfig.GRAY_800);
+ RenderManager.drawRoundedRect(vg, x + 224, y, 1056, 800, Colors.GRAY_800, Colors.CORNER_RADIUS_WIN);
+ RenderManager.drawRoundedRect(vg, x, y, 244, 800, Colors.GRAY_800_95, Colors.CORNER_RADIUS_WIN);
+ RenderManager.drawRect(vg, x + 224, y, 20, 800, Colors.GRAY_800);
}
- RenderManager.drawLine(vg, x + 224, y + 72, x + 1280, y + 72, 1, OneConfigConfig.GRAY_700);
- RenderManager.drawLine(vg, x + 224, y, x + 222, y + 800, 1, OneConfigConfig.GRAY_700);
+ 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, OneConfigConfig.WHITE, 18f, Fonts.BOLD); // added half line height to center text
- RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, OneConfigConfig.WHITE, 12f, Fonts.REGULAR);
+ RenderManager.drawText(vg, "OneConfig", x + 69, y + 32, Colors.WHITE, 18f, Fonts.BOLD); // added half line height to center text
+ RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, Colors.WHITE, 12f, Fonts.REGULAR);
textInputField.draw(vg, x + 1020, y + 16);
sideBar.draw(vg, x, y);
@@ -156,9 +155,9 @@ public class OneConfigGui extends UScreen {
String title = parents.get(i).getTitle();
float width = RenderManager.getTextWidth(vg, title, 24f, Fonts.SEMIBOLD);
boolean hovered = InputUtils.isAreaHovered((int) breadcrumbX, y + 24, (int) width, 36);
- int color = OneConfigConfig.WHITE_60;
- if (i == parents.size() - 1) color = OneConfigConfig.WHITE;
- else if (hovered && !Mouse.isButtonDown(0)) color = OneConfigConfig.WHITE_80;
+ int color = Colors.WHITE_60;
+ if (i == parents.size() - 1) color = Colors.WHITE;
+ else if (hovered && !Mouse.isButtonDown(0)) color = Colors.WHITE_80;
RenderManager.drawText(vg, title, breadcrumbX, y + 38, color, 24f, Fonts.SEMIBOLD);
if (i != 0)
RenderManager.drawSvg(vg, SVGs.CARET_RIGHT, breadcrumbX - 28, y + 25, 24, 24, color);
@@ -168,7 +167,7 @@ public class OneConfigGui extends UScreen {
long end = System.nanoTime() - start;
String s = (" draw: " + end / 1000000f + "ms");
- RenderManager.drawText(vg, s, x + 1170, y + 792, OneConfigConfig.GRAY_300, 10f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, s, x + 1170, y + 792, Colors.GRAY_300, 10f, Fonts.MEDIUM);
if (currentColorSelector != null) {
currentColorSelector.draw(vg);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index 236733a..b6f1160 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -1,17 +1,16 @@
package cc.polyfrost.oneconfig.gui;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.animations.Animation;
import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuart;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
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.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.image.SVGs;
import cc.polyfrost.oneconfig.test.ButtonTestPage;
-import cc.polyfrost.oneconfig.utils.GuiUtils;
+import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import java.util.ArrayList;
@@ -60,7 +59,7 @@ public class SideBar {
selected = buttons.indexOf(button);
}
if (moveAnimation != null) {
- RenderManager.drawRoundedRect(vg, x + 16, moveAnimation.get() - (sizeAnimation.get() - 36) / 2f, 192, sizeAnimation.get(0), OneConfigConfig.PRIMARY_600, 12);
+ RenderManager.drawRoundedRect(vg, x + 16, moveAnimation.get() - (sizeAnimation.get() - 36) / 2f, 192, sizeAnimation.get(0), Colors.PRIMARY_600, 12);
if (moveAnimation.isFinished() && sizeAnimation.isFinished()) {
moveAnimation = null;
sizeAnimation = null;
@@ -70,12 +69,12 @@ public class SideBar {
buttons.get(0).draw(vg, x + 16, y + 80);
buttons.get(1).draw(vg, x + 16, y + 116);
- RenderManager.drawText(vg, "MOD CONFIG", x + 16, y + 178, OneConfigConfig.WHITE, 12, Fonts.SEMIBOLD);
+ RenderManager.drawText(vg, "MOD CONFIG", x + 16, y + 178, Colors.WHITE, 12, Fonts.SEMIBOLD);
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);
- RenderManager.drawText(vg, "PERSONALIZATION", x + 16, y + 362, OneConfigConfig.WHITE, 12, Fonts.SEMIBOLD);
+ RenderManager.drawText(vg, "PERSONALIZATION", x + 16, y + 362, Colors.WHITE, 12, Fonts.SEMIBOLD);
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);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
index 3f2a552..a5cfae0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-import cc.polyfrost.oneconfig.utils.GuiUtils;
+import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
public abstract class Animation {
protected final boolean reverse;
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 36acffa..f3168dd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -1,11 +1,11 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.gui.Colors;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.pages.Page;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.image.SVGs;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import org.jetbrains.annotations.NotNull;
@@ -68,7 +68,7 @@ public class BasicButton extends BasicElement {
color = currentColor;
} else {
RenderManager.drawRoundedRect(vg, x, y, this.width, this.height, currentColor, this.cornerRadius);
- color = ColorUtils.setAlpha(OneConfigConfig.WHITE, (int) (colorAnimation.getAlpha() * 255));
+ color = ColorUtils.setAlpha(Colors.WHITE, (int) (colorAnimation.getAlpha() * 255));
}
final float middle = x + width / 2f;
final float middleYIcon = y + height / 2f - iconSize / 2f;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
index f0b930c..a4a3321 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.gui.elements;
import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.jetbrains.annotations.NotNull;
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 683be1e..d42d465 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.gui.Colors;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.animations.Animation;
@@ -9,12 +9,13 @@ import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.gui.elements.text.NumberInputField;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.lwjgl.image.Images;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
-import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
+import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.image.Images;
+import cc.polyfrost.oneconfig.renderer.image.SVGs;
+import cc.polyfrost.oneconfig.renderer.scissor.Scissor;
+import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
@@ -102,11 +103,11 @@ public class ColorSelector {
int height = 768;
Scissor scissor = ScissorManager.scissor(vg, x - 3, y - 3, width + 6, height + 6);
RenderManager.drawHollowRoundRect(vg, x - 3, y - 3, width + 4, height + 4, new Color(204, 204, 204, 77).getRGB(), 20f, 2f);
- RenderManager.drawRoundedRect(vg, x, y, width, height, OneConfigConfig.GRAY_800, 20f);
- RenderManager.drawText(vg, "Color Selector", x + 16, y + 32, OneConfigConfig.WHITE_90, 18f, Fonts.SEMIBOLD);
+ RenderManager.drawRoundedRect(vg, x, y, width, height, Colors.GRAY_800, 20f);
+ RenderManager.drawText(vg, "Color Selector", x + 16, y + 32, Colors.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_BOLD, 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() ? Colors.ERROR_600 : -1);
RenderManager.setAlpha(vg, 1f);
// hex parser
@@ -124,9 +125,9 @@ public class ColorSelector {
recentColors.get(i).draw(vg, x + 104 + i * 44, y + 720);
}
- RenderManager.drawRoundedRect(vg, x + 16, y + 64, 384, 32, OneConfigConfig.GRAY_500, 12f);
+ RenderManager.drawRoundedRect(vg, x + 16, y + 64, 384, 32, Colors.GRAY_500, 12f);
if (!barMoveAnimation.isFinished())
- RenderManager.drawRoundedRect(vg, x + barMoveAnimation.get(), y + 66, 124, 28, OneConfigConfig.PRIMARY_600, 10f);
+ RenderManager.drawRoundedRect(vg, x + barMoveAnimation.get(), y + 66, 124, 28, Colors.PRIMARY_600, 10f);
else buttons.get(mode).setColorPalette(ColorPalette.PRIMARY);
int i = 18;
@@ -144,22 +145,22 @@ public class ColorSelector {
}
float percentMoveMain = moveAnimation.get();
- RenderManager.drawText(vg, "Saturation", x + 224, y + 560, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, "Saturation", x + 224, y + 560, Colors.WHITE_80, 12f, Fonts.MEDIUM);
saturationInput.draw(vg, x + 312, y + 544);
- RenderManager.drawText(vg, "Brightness", x + 16, y + 599, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, "Brightness", x + 16, y + 599, Colors.WHITE_80, 12f, Fonts.MEDIUM);
brightnessInput.draw(vg, x + 104, y + 584);
- RenderManager.drawText(vg, "Alpha (%)", x + 224, y + 599, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, "Alpha (%)", x + 224, y + 599, Colors.WHITE_80, 12f, Fonts.MEDIUM);
alphaInput.draw(vg, x + 312, y + 584);
- RenderManager.drawText(vg, color.getDataBit() == -1 ? "Hex (RGB):" : "Color Code:", x + 16, y + 641, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, color.getDataBit() == -1 ? "Hex (RGB):" : "Color Code:", x + 16, y + 641, Colors.WHITE_80, 12f, Fonts.MEDIUM);
hexInput.draw(vg, x + 104, y + 624);
copyBtn.draw(vg, x + 204, y + 624);
pasteBtn.draw(vg, x + 244, y + 624);
if (mode != 2) {
- RenderManager.drawText(vg, "Hue", x + 16, y + 560, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, "Hue", x + 16, y + 560, Colors.WHITE_80, 12f, Fonts.MEDIUM);
hueInput.draw(vg, x + 104, y + 544);
} else {
- RenderManager.drawText(vg, "Speed (s)", x + 16, y + 560, OneConfigConfig.WHITE_80, 12f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, "Speed (s)", x + 16, y + 560, Colors.WHITE_80, 12f, Fonts.MEDIUM);
speedInput.draw(vg, x + 104, y + 544);
}
@@ -172,13 +173,13 @@ public class ColorSelector {
if (dragging && InputUtils.isClicked(true)) {
dragging = false;
}
- bottomSlider.setGradient(OneConfigConfig.TRANSPARENT, color.getRGBNoAlpha());
+ bottomSlider.setGradient(Colors.TRANSPARENT, color.getRGBNoAlpha());
RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 16, y + 456, 384, 16, 8f);
bottomSlider.draw(vg, x + 16, y + 456);
if (percentMoveMain > 0.96f) {
- RenderManager.drawRoundedRect(vg, mouseX - 7, mouseY - 7, 14, 14, OneConfigConfig.WHITE, 14f);
- RenderManager.drawRoundedRect(vg, mouseX - 6, mouseY - 6, 12, 12, OneConfigConfig.BLACK, 12f);
+ RenderManager.drawRoundedRect(vg, mouseX - 7, mouseY - 7, 14, 14, Colors.WHITE, 14f);
+ RenderManager.drawRoundedRect(vg, mouseX - 6, mouseY - 6, 12, 12, Colors.BLACK, 12f);
RenderManager.drawRoundedRect(vg, mouseX - 5, mouseY - 5, 10, 10, color.getRGBMax(true), 10f);
}
@@ -188,7 +189,7 @@ public class ColorSelector {
// draw the color preview
- RenderManager.drawHollowRoundRect(vg, x + 15, y + 487, 384, 40, OneConfigConfig.GRAY_300, 12f, 2f);
+ RenderManager.drawHollowRoundRect(vg, x + 15, y + 487, 384, 40, Colors.GRAY_300, 12f, 2f);
RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 20, y + 492, 376, 32, 8f);
RenderManager.drawRoundedRect(vg, x + 20, y + 492, 376, 32, color.getRGB(), 8f);
InputUtils.blockClicks(true);
@@ -213,8 +214,8 @@ public class ColorSelector {
}
if (mode == 2) {
speedSlider.draw(vg, x + 60, y + 424);
- RenderManager.drawText(vg, "SLOW", x + 16, y + 429, OneConfigConfig.WHITE_80, 12f, Fonts.REGULAR);
- RenderManager.drawText(vg, "FAST", x + 370, y + 429, OneConfigConfig.WHITE_80, 12f, Fonts.REGULAR);
+ RenderManager.drawText(vg, "SLOW", x + 16, y + 429, Colors.WHITE_80, 12f, Fonts.REGULAR);
+ RenderManager.drawText(vg, "FAST", x + 370, y + 429, Colors.WHITE_80, 12f, Fonts.REGULAR);
}
break;
case 1:
@@ -222,7 +223,7 @@ public class ColorSelector {
topSlider.setImage(null);
RenderManager.drawRoundImage(vg, Images.COLOR_WHEEL, x + 64, y + 120, 288, 288, 144f);
- topSlider.setGradient(OneConfigConfig.BLACK, color.getRGBMax(true));
+ topSlider.setGradient(Colors.BLACK, color.getRGBMax(true));
topSlider.setImage(null);
topSlider.draw(vg, x + 16, y + 424);
break;
@@ -427,8 +428,8 @@ public class ColorSelector {
}
RenderManager.drawHollowRoundRect(vg, x - 0.5f, y - 0.5f, width, height, new Color(204, 204, 204, 80).getRGB(), 8f, 1f);
- RenderManager.drawHollowRoundRect(vg, currentDragPoint - 1, y - 1, 18, 18, OneConfigConfig.WHITE, 9f, 1f);
- RenderManager.drawHollowRoundRect(vg, currentDragPoint, y, 16, 16, OneConfigConfig.BLACK, 8f, 1f);
+ RenderManager.drawHollowRoundRect(vg, currentDragPoint - 1, y - 1, 18, 18, Colors.WHITE, 9f, 1f);
+ RenderManager.drawHollowRoundRect(vg, currentDragPoint, y, 16, 16, Colors.BLACK, 8f, 1f);
RenderManager.drawRoundedRect(vg, currentDragPoint + 1.5f, y + 1.5f, 14, 14, color, 7f);
}
@@ -456,8 +457,8 @@ public class ColorSelector {
@Override
public void draw(long vg, int x, int y) {
- RenderManager.drawRoundedRect(vg, x, y, 32, 32, toggled ? OneConfigConfig.PRIMARY_600 : OneConfigConfig.GRAY_300, 12f);
- RenderManager.drawRoundedRect(vg, x + 2, y + 2, 28, 28, OneConfigConfig.GRAY_800, 10f);
+ RenderManager.drawRoundedRect(vg, x, y, 32, 32, toggled ? Colors.PRIMARY_600 : Colors.GRAY_300, 12f);
+ RenderManager.drawRoundedRect(vg, x + 2, y + 2, 28, 28, Colors.GRAY_800, 10f);
RenderManager.drawRoundedRect(vg, x + 4, y + 4, 24, 24, color.getRGB(), 8f);
update(x, y);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
index bac855e..f48e1af 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -1,16 +1,16 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.OneConfig;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.internal.OneConfig;
+import cc.polyfrost.oneconfig.gui.Colors;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
-import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.image.SVGs;
+import cc.polyfrost.oneconfig.renderer.scissor.Scissor;
+import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.color.ColorUtils;
@@ -51,17 +51,17 @@ public class ModCard extends BasicElement {
if (disabled) RenderManager.setAlpha(vg, 0.5f);
RenderManager.drawRoundedRectVaried(vg, x, y, width, 87, colorFrame.getColor(isHoveredMain, isHoveredMain && Mouse.isButtonDown(0)), 12f, 12f, 0f, 0f);
RenderManager.drawRoundedRectVaried(vg, x, y + 87