aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java55
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java1
2 files changed, 55 insertions, 1 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
new file mode 100644
index 0000000..8dea265
--- /dev/null
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -0,0 +1,55 @@
+package io.polyfrost.oneconfig.gui.elements.config;
+
+import io.polyfrost.oneconfig.config.OneConfigConfig;
+import io.polyfrost.oneconfig.config.interfaces.BasicOption;
+import io.polyfrost.oneconfig.lwjgl.RenderManager;
+import io.polyfrost.oneconfig.lwjgl.font.Fonts;
+import org.lwjgl.nanovg.NanoVG;
+
+import java.lang.reflect.Field;
+
+public class ConfigDropdown extends BasicOption {
+ private final String[] options;
+ public ConfigDropdown(Field field, String name, int size, String[] options) {
+ super(field, name, size);
+ this.options = options;
+ }
+
+ @Override
+ public void draw(long vg, int x, int y) {
+
+ }
+
+ @Override
+ public void drawLast(long vg, int x, int y) {
+ int selected = 0;
+ try {
+ selected = (int) get();
+ } catch (IllegalAccessException ignored) {
+ }
+
+ RenderManager.drawString(vg, name, x, y + 16, OneConfigConfig.WHITE_90, 14f, Fonts.INTER_MEDIUM);
+
+ if (size == 1) {
+ RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, OneConfigConfig.GRAY_500, 12);
+ RenderManager.drawString(vg, options[selected], x + 236, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.INTER_MEDIUM);
+ RenderManager.drawRoundedRect(vg, x + 452, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8);
+ RenderManager.drawImage(vg, "/assets/oneconfig/textures/dropdown_arrow.png", x + 459, y + 8, 10, 6);
+ NanoVG.nvgTranslate(vg, x + 469, y + 24);
+ } else {
+ RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, OneConfigConfig.GRAY_500, 12);
+ RenderManager.drawString(vg, options[selected], x + 364, y + 16, OneConfigConfig.WHITE_80, 14f, Fonts.INTER_MEDIUM);
+ RenderManager.drawRoundedRect(vg, x + 964, y + 4, 24, 24, OneConfigConfig.BLUE_600, 8);
+ RenderManager.drawImage(vg, "/assets/oneconfig/textures/dropdown_arrow.png", x + 971, y + 8, 10, 6);
+ NanoVG.nvgTranslate(vg, x + 981, y + 24);
+ }
+ NanoVG.nvgRotate(vg, (float) Math.toRadians(180));
+ RenderManager.drawImage(vg, "/assets/oneconfig/textures/dropdown_arrow.png", 0, 0, 10, 6);
+ NanoVG.nvgResetTransform(vg);
+ }
+
+ @Override
+ public int getHeight() {
+ return 32;
+ }
+}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
index b3f689c..b999137 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
@@ -32,7 +32,6 @@ public class ConfigTextBox extends BasicOption {
} catch (IllegalAccessException ignored) {
}
-
textField.draw(vg, x + (size == 1 && hasHalfSize() ? 224 : 352), y);
if (secure) RenderManager.drawImage(vg, "/assets/oneconfig/textures/eye.png", x + 967, y + 7, 18, 18, new Color(196,196,196).getRGB());