aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
-rw-r--r--src/main/resources/assets/oneconfig/textures/arrow.pngbin0 -> 190 bytes
4 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");
}
diff --git a/src/main/resources/assets/oneconfig/textures/arrow.png b/src/main/resources/assets/oneconfig/textures/arrow.png
new file mode 100644
index 0000000..426a17f
--- /dev/null
+++ b/src/main/resources/assets/oneconfig/textures/arrow.png
Binary files differ