aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-28 18:27:17 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-28 18:27:17 +0200
commit2bd98e18587f56dcde427aba5a8639ce36394806 (patch)
tree973af289d5f924dfc627c8578d21e175add8866f /src/main/java/io/polyfrost
parent32ba7fdd887a098273a42484048e286b8f0e97f6 (diff)
downloadOneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.tar.gz
OneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.tar.bz2
OneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.zip
stuff
Diffstat (limited to 'src/main/java/io/polyfrost')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java2
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java28
-rw-r--r--src/main/java/io/polyfrost/oneconfig/test/TestConfig.java8
3 files changed, 36 insertions, 2 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
index cbb7610..06e3e4e 100644
--- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java
@@ -68,7 +68,6 @@ public class Config {
*/
protected void generateOptionList(Class<?> clazz, OptionPage page, Mod mod) {
for (Field field : clazz.getDeclaredFields()) {
- System.out.println(field);
if (!field.isAnnotationPresent(Option.class)) {
processCustomOption(field, page);
continue;
@@ -86,7 +85,6 @@ public class Config {
field.setAccessible(true);
Object object = field.get(clazz);
generateOptionList(object.getClass(), newPage, mod);
- System.out.println(newPage.categories);
options.add(new ConfigPage(field, option.name(), option.description(), option.size(), newPage));
} catch (IllegalAccessException e) {
continue;
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
index 1a2d001..eb341f7 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java
@@ -1,13 +1,23 @@
package io.polyfrost.oneconfig.gui.elements.config;
+import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.config.data.OptionPage;
import io.polyfrost.oneconfig.config.interfaces.BasicOption;
+import io.polyfrost.oneconfig.gui.OneConfigGui;
+import io.polyfrost.oneconfig.gui.pages.ModConfigPage;
+import io.polyfrost.oneconfig.lwjgl.RenderManager;
+import io.polyfrost.oneconfig.lwjgl.font.Fonts;
+import io.polyfrost.oneconfig.utils.ColorUtils;
+import io.polyfrost.oneconfig.utils.InputUtils;
+import org.lwjgl.input.Mouse;
+import org.lwjgl.nanovg.NanoVG;
import java.lang.reflect.Field;
public class ConfigPage extends BasicOption {
public final OptionPage page;
public final String description;
+ private int backgroundColor = OneConfigConfig.GRAY_500;
public ConfigPage(Field field, String name, String description, int size, OptionPage page) {
super(field, name, size);
@@ -17,7 +27,25 @@ public class ConfigPage extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
+ boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1023, description.equals("") ? 64 : 96);
+ boolean clicked = hovered && Mouse.isButtonDown(0);
+ backgroundColor = ColorUtils.smoothColor(backgroundColor, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, hovered, 100);
+ if (clicked)
+ NanoVG.nvgGlobalAlpha(vg, 0.8f);
+
+ RenderManager.drawRoundedRect(vg, x - 2, y, 1024, description.equals("") ? 64 : 96, backgroundColor, 20);
+ RenderManager.drawString(vg, name, x + 24, y + 32, OneConfigConfig.WHITE, 24, Fonts.INTER_MEDIUM);
+ if (!description.equals(""))
+ RenderManager.drawString(vg, name, x + 24, y + 70, OneConfigConfig.WHITE, 14, Fonts.INTER_MEDIUM);
+ RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 995f, y + (description.equals("") ? 20f : 36f), 13, 22);
+
+ RenderManager.drawRect(vg, x, y, 1024, 20, OneConfigConfig.WHITE);
+ RenderManager.drawRect(vg, x, y + 64 - 20, 1024, 20, OneConfigConfig.WHITE);
+
+ if (clicked)
+ OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
+ NanoVG.nvgGlobalAlpha(vg, 1f);
}
@Override
diff --git a/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
index d045df0..6cb82da 100644
--- a/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
+++ b/src/main/java/io/polyfrost/oneconfig/test/TestConfig.java
@@ -23,6 +23,14 @@ public class TestConfig extends Config {
)
public static TestPage testPage = new TestPage();
+ @Option(
+ name = "Test Page But better",
+ type = OptionType.PAGE,
+ subcategory = "Test",
+ description = "The best page to have ever existed"
+ )
+ public static TestPage testPage2 = new TestPage();
+
public TestConfig() {
super(new Mod("hacks", ModType.UTIL_QOL, "ShadyDev", "1.0"), "hacksConfig.json");
}