aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/config')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java4
13 files changed, 28 insertions, 27 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
index 643bc90..2e8cb4f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
@@ -12,8 +12,8 @@ import java.lang.reflect.Field;
public class ConfigButton extends BasicOption {
private final BasicButton button;
- public ConfigButton(Field field, String name, int size, String text) {
- super(field, name, size);
+ public ConfigButton(Field field, Object parent, String name, int size, String text) {
+ super(field, parent, name, size);
Runnable runnable = () -> {
};
try {
@@ -27,7 +27,7 @@ public class ConfigButton extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
button.disable(!isEnabled());
- NanoVG.nvgGlobalAlpha(vg, 0.5f);
+ if(!isEnabled()) NanoVG.nvgGlobalAlpha(vg, 0.5f);
RenderManager.drawString(vg, name, x, y + 17, OneConfigConfig.WHITE, 14f, Fonts.MEDIUM);
button.draw(vg, x + (size == 1 ? 352 : 736), y);
NanoVG.nvgGlobalAlpha(vg, 1f);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
index a1c8b9c..8a30d71 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java
@@ -17,8 +17,8 @@ public class ConfigCheckbox extends BasicOption {
private int color;
private float percentOn = 0f;
- public ConfigCheckbox(Field field, String name, int size) {
- super(field, name, size);
+ public ConfigCheckbox(Field field, Object parent, String name, int size) {
+ super(field, parent, name, size);
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
index ba533da..aed367f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
@@ -24,8 +24,8 @@ public class ConfigColorElement extends BasicOption {
private final TextInputField alphaField = new TextInputField(72, 32, "", false, false);
private final BasicElement element = new BasicElement(64, 32, false);
- public ConfigColorElement(Field field, String name, int size) {
- super(field, name, size);
+ public ConfigColorElement(Field field, Object parent, String name, int size) {
+ super(field, parent, name, size);
hexField.setCentered(true);
alphaField.setCentered(true);
alphaField.onlyAcceptNumbers(true);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
index 2805fd4..c2cb0cf 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -20,8 +20,8 @@ public class ConfigDropdown extends BasicOption { // TODO: chose where dividers
private boolean opened = false;
private int[] dividers;
- public ConfigDropdown(Field field, String name, int size, String[] options, int [] dividers) {
- super(field, name, size);
+ public ConfigDropdown(Field field, Object parent, String name, int size, String[] options, int [] dividers) {
+ super(field, parent, name, size);
this.options = options;
this.dividers = dividers;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
index c05a370..42c8fea 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
@@ -14,8 +14,8 @@ public class ConfigDualOption extends BasicOption {
private float percentMove = 0f;
private final String left, right;
- public ConfigDualOption(Field field, String name, int size, String[] options) {
- super(field, name, size);
+ public ConfigDualOption(Field field, Object parent, String name, int size, String[] options) {
+ super(field, parent, name, size);
this.left = options[0];
this.right = options[1];
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java
index 3ef3d06..c7c7ea9 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java
@@ -11,8 +11,8 @@ import java.lang.reflect.Field;
public class ConfigHeader extends BasicOption {
- public ConfigHeader(Field field, String name, int size) {
- super(field, name, size);
+ public ConfigHeader(Field field, Object parent, String name, int size) {
+ super(field, parent, name, size);
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
index 1eda01b..2e29328 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java
@@ -14,8 +14,8 @@ import java.lang.reflect.Field;
public class ConfigInfo extends BasicOption {
private Images image;
- public ConfigInfo(Field field, String name, int size, InfoType type) {
- super(field, name, size);
+ public ConfigInfo(Field field, Object parent, String name, int size, InfoType type) {
+ super(field, parent, name, size);
switch (type) {
case INFO:
image = Images.INFO;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
index 476e58d..f8669a2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
@@ -17,8 +17,8 @@ public class ConfigKeyBind extends BasicOption {
private final BasicButton button;
private boolean clicked = false;
- public ConfigKeyBind(Field field, String name, int size) {
- super(field, name, size);
+ public ConfigKeyBind(Field field, Object parent, String name, int size) {
+ super(field, parent, name, size);
button = new BasicButton(256, 32, "", Images.KEYSTROKE, null, 0, BasicButton.ALIGNMENT_CENTER, true);
button.alignIconLeft(true);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
index 42f7568..3288123 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
@@ -20,8 +20,8 @@ public class ConfigPageButton extends BasicOption {
public final String description;
private int backgroundColor = OneConfigConfig.GRAY_500;
- public ConfigPageButton(Field field, String name, String description, OptionPage page) {
- super(field, name, 2);
+ public ConfigPageButton(Field field, Object parent, String name, String description, OptionPage page) {
+ super(field, parent, name, 2);
this.description = description;
this.page = page;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
index 3a4253c..29d132a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
@@ -19,8 +19,8 @@ public class ConfigSlider extends BasicOption {
private final int step;
private boolean dragging = false;
- public ConfigSlider(Field field, String name, int size, float min, float max, int step) {
- super(field, name, size);
+ public ConfigSlider(Field field, Object parent, String name, int size, float min, float max, int step) {
+ super(field, parent, name, size);
this.min = min;
this.max = max;
this.step = step;
@@ -32,6 +32,7 @@ public class ConfigSlider extends BasicOption {
int xCoordinate = 0;
float value = 0;
boolean hovered = InputUtils.isAreaHovered(x + 352, y, 512, 32) && isEnabled();
+ inputField.disable(!isEnabled());
if (!isEnabled()) NanoVG.nvgGlobalAlpha(vg, 0.5f);
if (hovered && Mouse.isButtonDown(0)) dragging = true;
if (dragging) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
index 3ce4693..aa0dc1d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
@@ -15,8 +15,8 @@ public class ConfigSwitch extends BasicOption {
private int color;
private float percentOn = 0f;
- public ConfigSwitch(Field field, String name, int size) {
- super(field, name, size);
+ public ConfigSwitch(Field field, Object parent, String name, int size) {
+ super(field, parent, name, size);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
index 1fb7c84..3aa4050 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java
@@ -17,8 +17,8 @@ public class ConfigTextBox extends BasicOption {
private final boolean multiLine;
private final TextInputField textField;
- public ConfigTextBox(Field field, String name, int size, String placeholder, boolean secure, boolean multiLine) {
- super(field, name, size);
+ public ConfigTextBox(Field field, Object parent, String name, int size, String placeholder, boolean secure, boolean multiLine) {
+ super(field, parent, name, size);
this.secure = secure;
this.multiLine = multiLine;
this.textField = new TextInputField(size == 1 && hasHalfSize() ? 256 : 640, multiLine ? 64 : 32, placeholder, multiLine, secure);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
index e77357f..a9b0ab1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigUniSelector.java
@@ -18,8 +18,8 @@ public class ConfigUniSelector extends BasicOption {
private float percentMove = 1f;
private int previous = -1;
- public ConfigUniSelector(Field field, String name, int size, String[] options) {
- super(field, name, size);
+ public ConfigUniSelector(Field field, Object parent, String name, int size, String[] options) {
+ super(field, parent, name, size);
this.options = options;
}