aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java19
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java35
5 files changed, 56 insertions, 28 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
index 62ccd86..a590536 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
@@ -52,7 +52,14 @@ public class OneConfigConfig extends Config {
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 ERROR_700 = new Color(180, 24, 24, 255).getRGB(); // Red 700
+ 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 = new Color(217, 32, 32).getRGB();
+ public static final int ERROR_700 = new Color(180, 24, 24).getRGB(); // Red 700
public static boolean ROUNDED_CORNERS = true;
public static float CORNER_RADIUS_WIN = 20f;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 97e03a6..7ac0371 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -9,7 +9,6 @@ import cc.polyfrost.oneconfig.gui.pages.Page;
import cc.polyfrost.oneconfig.lwjgl.OneColor;
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;
@@ -28,8 +27,6 @@ import java.util.ArrayList;
public class OneConfigGui extends UScreen {
public static OneConfigGui INSTANCE;
- public final int x = 320;
- public final int y = 140;
private final SideBar sideBar = new SideBar();
protected Page currentPage;
protected Page prevPage;
@@ -61,6 +58,7 @@ public class OneConfigGui extends UScreen {
try {
return instanceToRestore == null ? new OneConfigGui() : instanceToRestore;
} finally {
+ if (instanceToRestore != null) INSTANCE = instanceToRestore;
instanceToRestore = null;
}
}
@@ -74,7 +72,11 @@ public class OneConfigGui extends UScreen {
currentPage = new HomePage();
parents.add(currentPage);
}
- scale = UResolution.getWindowWidth() / 1920f;
+ scale = Math.min(UResolution.getWindowWidth() / 1920f, UResolution.getWindowHeight() / 1080f);
+ if (scale < 1)
+ scale = Math.min(Math.min(1f, UResolution.getWindowWidth() / 1280f), Math.min(1f, UResolution.getWindowHeight() / 800f));
+ int x = (int) ((UResolution.getWindowWidth() - 1280 * scale) / 2f / scale);
+ int y = (int) ((UResolution.getWindowHeight() - 800 * scale) / 2f / scale);
NanoVG.nvgScale(vg, scale, scale);
if (OneConfigConfig.ROUNDED_CORNERS) {
RenderManager.drawRoundedRect(vg, x + 224, y, 1056, 800, OneConfigConfig.GRAY_800, OneConfigConfig.CORNER_RADIUS_WIN);
@@ -89,10 +91,6 @@ public class OneConfigGui extends UScreen {
RenderManager.drawString(vg, "OneConfig", x + 69, y + 32, OneConfigConfig.WHITE, 18f, Fonts.BOLD); // added half line height to center text
RenderManager.drawString(vg, "ALPHA - By Polyfrost", x + 69, y + 51, OneConfigConfig.WHITE, 12f, Fonts.REGULAR);
-
- //RenderManager.drawRect(vg, x + 300, y + 500, 400, 12, OneConfigConfig.ERROR_700);
- //RenderManager.drawString(vg, "MoonTidez is Annoyinhg here is an f |||", x + 300, y + 500, OneConfigConfig.WHITE, 14f, 14,Fonts.INTER_REGULAR);
-
textInputField.draw(vg, x + 1020, y + 16);
sideBar.draw(vg, x, y);
backArrow.draw(vg, x + 240, y + 16);
@@ -254,6 +252,7 @@ public class OneConfigGui extends UScreen {
@Override
public void onScreenClose() {
currentPage.finishUpAndClose();
+ instanceToRestore = this;
INSTANCE = null;
super.onScreenClose();
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index fcbf647..19d48a1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -42,10 +42,10 @@ public class SideBar {
public void draw(long vg, int x, int y) {
currentY = MathUtils.easeInOutCirc(50, currentY, targetY - currentY, 120);
- RenderManager.drawRoundedRect(vg, x + 16, currentY, 192, 36, OneConfigConfig.BLUE_600, OneConfigConfig.CORNER_RADIUS);
+ RenderManager.drawRoundedRect(vg, x + 16, y + currentY, 192, 36, OneConfigConfig.BLUE_600, OneConfigConfig.CORNER_RADIUS);
int i = 0;
if (targetY == 0) {
- targetY = y + 96;
+ targetY = 96;
currentY = targetY;
}
for (BasicButton btn : btnList) {
@@ -65,7 +65,7 @@ public class SideBar {
}
if (btn.isClicked() && btn.getPage() != null) {
- if (i < 520) targetY = btn.y;
+ if (i < 520) targetY = btn.y - y;
}
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
index 68ebf37..7810d57 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
@@ -13,30 +13,17 @@ import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import java.lang.reflect.Field;
public class ConfigInfo extends BasicOption {
- private SVGs image;
+ private InfoType type;
public ConfigInfo(Field field, Object parent, String name, int size, InfoType type) {
super(field, parent, name, size);
- switch (type) {
- case INFO:
- image = SVGs.INFO_CIRCLE;
- break;
- case SUCCESS:
- image = SVGs.CHECK_CIRCLE;
- break;
- case WARNING:
- image = SVGs.WARNING;
- break;
- case ERROR:
- image = SVGs.ERROR;
- break;
- }
+ this.type = type;
}
@Override
public void draw(long vg, int x, int y) {
Scissor scissor = ScissorManager.scissor(vg, x, y, size == 1 ? 448 : 960, 32);
- RenderManager.drawSvg(vg, image, x, y + 4, 24, 24);
+ RenderManager.drawInfo(vg, type, x, y + 4, 24);
RenderManager.drawString(vg, name, x + 32, y + 18, OneConfigConfig.WHITE_90, 14, Fonts.MEDIUM);
ScissorManager.resetScissor(vg, scissor);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index a2da805..153fc52 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -1,6 +1,7 @@
package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.config.data.InfoType;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.lwjgl.font.FontManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
@@ -344,6 +345,40 @@ public final class RenderManager {
drawSvg(vg, svg.filePath, x, y, width, height, color);
}
+ public static void drawInfo(long vg, InfoType type, float x, float y, float size) {
+ SVGs icon = null;
+ int colorOuter = 0;
+ int colorInner = 0;
+ switch (type) {
+ case INFO:
+ icon = SVGs.INFO_CIRCLE;
+ colorOuter = OneConfigConfig.GRAY_400;
+ colorInner = OneConfigConfig.GRAY_300;
+ break;
+ case SUCCESS:
+ icon = SVGs.CHECK_CIRCLE;
+ colorOuter = OneConfigConfig.SUCCESS_700;
+ colorInner = OneConfigConfig.SUCCESS_600;
+ break;
+ case WARNING:
+ icon = SVGs.WARNING;
+ colorOuter = OneConfigConfig.WARNING_600;
+ colorInner = OneConfigConfig.WARNING_500;
+ break;
+ case ERROR:
+ icon = SVGs.ERROR;
+ colorOuter = OneConfigConfig.ERROR_700;
+ colorInner = OneConfigConfig.ERROR_600;
+ break;
+ }
+ float centerX = x + size / 2f;
+ float centerY = y + size / 2f;
+ drawCircle(vg, centerX, centerY, size / 2, colorOuter);
+ drawCircle(vg, centerX, centerY, size / 2 - size / 12, colorInner);
+ float iconSize = size / 1.75f;
+ drawSvg(vg, icon, centerX - iconSize / 2f, centerY - iconSize / 2f, iconSize, iconSize);
+ }
+
/*public static void drawSvg(long vg, String filename) {
if (ImageLoader.INSTANCE.loadSVGImage(filename)) {
try {