aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/gui/elements/config
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-02 10:19:08 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-05-02 10:19:08 +0100
commitd5f03a5d3880256a0cfd92d0dbb1ca8f94e8c528 (patch)
treed26c5745bc2f3bfbf2be358ee75bfb2c9991bbac /src/main/java/io/polyfrost/oneconfig/gui/elements/config
parent0efc327a74c128fd9b694872643f0fd090ca1363 (diff)
downloadOneConfig-d5f03a5d3880256a0cfd92d0dbb1ca8f94e8c528.tar.gz
OneConfig-d5f03a5d3880256a0cfd92d0dbb1ca8f94e8c528.tar.bz2
OneConfig-d5f03a5d3880256a0cfd92d0dbb1ca8f94e8c528.zip
images loading changes, directory structure and cleanup of rendering and general code
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/elements/config')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java5
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java14
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java3
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java7
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java6
-rw-r--r--src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java5
6 files changed, 23 insertions, 17 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
index 93f4378..5f506f7 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
@@ -4,6 +4,7 @@ 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 io.polyfrost.oneconfig.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.ColorUtils;
import io.polyfrost.oneconfig.utils.InputUtils;
import io.polyfrost.oneconfig.utils.MathUtils;
@@ -47,9 +48,9 @@ public class ConfigCheckbox extends BasicOption {
percentOn = MathUtils.clamp(MathUtils.easeOut(percentOn, toggled ? 1f : 0f, 5f));
if (percentOn == 0f) return;
if (percentOn != 1f) {
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/check.png", x, y + 4, 24, 24, new Color(1f, 1f, 1f, percentOn).getRGB());
+ RenderManager.drawImage(vg, Images.CHECKMARK, x, y + 4, 24, 24, new Color(1f, 1f, 1f, percentOn).getRGB());
} else { // performance, that color could cause havoc am I right definitely
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/check.png", x, y + 4, 24, 24);
+ RenderManager.drawImage(vg, Images.CHECKMARK, x, y + 4, 24, 24);
}
}
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
index 921ad10..af34e06 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -1,10 +1,10 @@
package io.polyfrost.oneconfig.gui.elements.config;
-import io.polyfrost.oneconfig.OneConfig;
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 io.polyfrost.oneconfig.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.ColorUtils;
import io.polyfrost.oneconfig.utils.InputUtils;
import org.lwjgl.input.Mouse;
@@ -50,17 +50,17 @@ public class ConfigDropdown extends BasicOption {
RenderManager.drawRoundedRect(vg, x + 224, y, 256, 32, backgroundColor, 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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 8, 10, 6);
NanoVG.nvgTranslate(vg, x + 469, y + 24);
} else {
RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, 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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, 0, 0, 10, 6);
NanoVG.nvgResetTransform(vg);
NanoVG.nvgGlobalAlpha(vg, 1f);
}
@@ -114,7 +114,7 @@ public class ConfigDropdown extends BasicOption {
if (hovered && Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f);
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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, x + 459, y + 8, 10, 6);
NanoVG.nvgTranslate(vg, x + 469, y + 24);
} else {
RenderManager.drawRoundedRect(vg, x + 352, y, 640, 32, backgroundColor, 12);
@@ -149,11 +149,11 @@ public class ConfigDropdown extends BasicOption {
if (hovered && Mouse.isButtonDown(0)) NanoVG.nvgGlobalAlpha(vg, 0.8f);
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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, 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);
+ RenderManager.drawImage(vg, Images.DROPDOWN_ARROW, 0, 0, 10, 6);
NanoVG.nvgResetTransform(vg);
NanoVG.nvgGlobalAlpha(vg, 1f);
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
index c32b76e..fd46bc8 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
@@ -7,6 +7,7 @@ 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.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.ColorUtils;
import io.polyfrost.oneconfig.utils.InputUtils;
import org.lwjgl.input.Mouse;
@@ -38,7 +39,7 @@ public class ConfigPageButton extends BasicOption {
RenderManager.drawString(vg, name, x + 10, y + 32, OneConfigConfig.WHITE_90, 24, Fonts.INTER_MEDIUM);
if (!description.equals(""))
RenderManager.drawString(vg, name, x + 10, y + 70, OneConfigConfig.WHITE_90, 14, Fonts.INTER_MEDIUM);
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 981f, y + (description.equals("") ? 20f : 36f), 13, 22);
+ RenderManager.drawImage(vg, Images.CHEVRON_ARROW, x + 981f, y + (description.equals("") ? 20f : 36f), 13, 22);
if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page));
NanoVG.nvgGlobalAlpha(vg, 1f);
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
index 25b3eab..47ce15c 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
@@ -6,6 +6,7 @@ import io.polyfrost.oneconfig.gui.elements.BasicElement;
import io.polyfrost.oneconfig.gui.elements.TextInputField;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
+import io.polyfrost.oneconfig.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.ColorUtils;
import io.polyfrost.oneconfig.utils.InputUtils;
import io.polyfrost.oneconfig.utils.MathUtils;
@@ -24,7 +25,7 @@ public class ConfigSlider extends BasicOption {
private int colorTop, colorBottom;
private boolean isFloat = true;
private Float prevAsNum = null;
- private int step;
+ private final int step;
public ConfigSlider(Field field, String name, int size, float min, float max, int step) {
super(field, name, size);
@@ -128,14 +129,14 @@ public class ConfigSlider extends BasicOption {
}
if (current == 1f) NanoVG.nvgGlobalAlpha(vg, 0.3f);
RenderManager.drawRoundedRectVaried(vg, x + 980, y, 12, 14, colorTop, 6f, 6f, 0f, 0f);
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/smallUpArrow.png", x + 981, y + 2, 10, 10);
+ RenderManager.drawImage(vg, Images.UP_ARROW, x + 981, y + 2, 10, 10);
if (current == 1f) NanoVG.nvgGlobalAlpha(vg, 1f);
if (current == 0f) NanoVG.nvgGlobalAlpha(vg, 0.3f);
RenderManager.drawRoundedRectVaried(vg, x + 980, y + 14, 12, 14, colorBottom, 0f, 0f, 6f, 6f);
NanoVG.nvgTranslate(vg, x + 991, y + 25);
NanoVG.nvgRotate(vg, (float) Math.toRadians(180));
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/smallUpArrow.png", 0, 0, 10, 10);
+ RenderManager.drawImage(vg, Images.UP_ARROW, 0, 0, 10, 10);
NanoVG.nvgResetTransform(vg);
NanoVG.nvgGlobalAlpha(vg, 1f);
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 b999137..8cd7565 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
@@ -5,6 +5,7 @@ import io.polyfrost.oneconfig.config.interfaces.BasicOption;
import io.polyfrost.oneconfig.gui.elements.TextInputField;
import io.polyfrost.oneconfig.lwjgl.RenderManager;
import io.polyfrost.oneconfig.lwjgl.font.Fonts;
+import io.polyfrost.oneconfig.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.InputUtils;
import java.awt.*;
@@ -28,13 +29,14 @@ public class ConfigTextBox extends BasicOption {
try {
String value = (String) get();
- textField.setInput(value == null ? "" : value);
+ textField.setInput(value == null ? "" : value);
} 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());
+ if (secure)
+ RenderManager.drawImage(vg, Images.HIDE_EYE, x + 967, y + 7, 18, 18, new Color(196, 196, 196).getRGB());
if (secure && InputUtils.isAreaClicked(x + 967, y + 7, 18, 18)) textField.setPassword(!textField.getPassword());
}
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
index 5acdae0..18bebbf 100644
--- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
+++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
@@ -4,6 +4,7 @@ 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 io.polyfrost.oneconfig.lwjgl.image.Images;
import io.polyfrost.oneconfig.utils.InputUtils;
import io.polyfrost.oneconfig.utils.MathUtils;
import org.lwjgl.nanovg.NanoVG;
@@ -49,9 +50,9 @@ public class ConfigUniSelector extends BasicOption {
// actual coordinates: 240, 7
NanoVG.nvgTranslate(vg, x + 248, y + 21);
NanoVG.nvgRotate(vg, (float) Math.toRadians(180));
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", 0, 0, 8, 14, OneConfigConfig.BLUE_400);
+ RenderManager.drawImage(vg, Images.CHEVRON_ARROW, 0, 0, 8, 14, OneConfigConfig.BLUE_400);
NanoVG.nvgResetTransform(vg);
- RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 456, y + 7, 8, 14, OneConfigConfig.BLUE_400);
+ RenderManager.drawImage(vg, Images.CHEVRON_ARROW, x + 456, y + 7, 8, 14, OneConfigConfig.BLUE_400);
if (InputUtils.isAreaClicked(x + 235, y + 5, 18, 18) && selected > 0) {
previous = selected;