diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-28 18:27:17 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-28 18:27:17 +0200 |
commit | 2bd98e18587f56dcde427aba5a8639ce36394806 (patch) | |
tree | 973af289d5f924dfc627c8578d21e175add8866f /src/main/java/io/polyfrost/oneconfig/gui | |
parent | 32ba7fdd887a098273a42484048e286b8f0e97f6 (diff) | |
download | OneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.tar.gz OneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.tar.bz2 OneConfig-2bd98e18587f56dcde427aba5a8639ce36394806.zip |
stuff
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java | 28 |
1 files changed, 28 insertions, 0 deletions
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 |