aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/config
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-11 19:56:27 +0700
committerWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-11 19:56:27 +0700
commitb41e6fd6cbfee6b3b31855447f9ba79d68846e4e (patch)
tree8a07948d711eda51c9664c100e9ec58fd8ce61a6 /src/main/java/cc/polyfrost/oneconfig/gui/elements/config
parentb1d03048892dfe736bcae057d4f7ac565a16f112 (diff)
parent744e295d86805955194d8b203e5e5dbffe1228fd (diff)
downloadOneConfig-b41e6fd6cbfee6b3b31855447f9ba79d68846e4e.tar.gz
OneConfig-b41e6fd6cbfee6b3b31855447f9ba79d68846e4e.tar.bz2
OneConfig-b41e6fd6cbfee6b3b31855447f9ba79d68846e4e.zip
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui/elements/config')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java10
1 files changed, 6 insertions, 4 deletions
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 5cd9c83..5efebdd 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
@@ -20,24 +20,26 @@ public class ConfigColorElement extends BasicOption {
private final TextInputField alphaField = new TextInputField(72, 32, "", false, false);
private final BasicElement element = new BasicElement(64, 32, false);
private boolean open = false;
+ private final boolean allowAlpha;
- public ConfigColorElement(Field field, Object parent, String name, String category, String subcategory, int size) {
+ public ConfigColorElement(Field field, Object parent, String name, String category, String subcategory, int size, boolean allowAlpha) {
super(field, parent, name, category, subcategory, size);
hexField.setCentered(true);
alphaField.setCentered(true);
alphaField.onlyAcceptNumbers(true);
+ this.allowAlpha = allowAlpha;
}
public static ConfigColorElement create(Field field, Object parent) {
Color color = field.getAnnotation(Color.class);
- return new ConfigColorElement(field, parent, color.name(), color.category(), color.subcategory(), color.size());
+ return new ConfigColorElement(field, parent, color.name(), color.category(), color.subcategory(), color.size(), color.allowAlpha());
}
@Override
public void draw(long vg, int x, int y) {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
hexField.disable(!isEnabled());
- alphaField.disable(!isEnabled());
+ alphaField.disable(!isEnabled() || allowAlpha);
element.disable(!isEnabled());
int x1 = size == 1 ? x : x + 512;
@@ -85,7 +87,7 @@ public class ConfigColorElement extends BasicOption {
RenderManager.drawRoundedRect(vg, x1 + 420, y + 4, 56, 24, color.getRGB(), 8f);
if (element.isClicked() && !element.isToggled()) {
open = !open;
- OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY()));
+ OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY(), allowAlpha));
}
if (OneConfigGui.INSTANCE.currentColorSelector == null) open = false;
if (OneConfigGui.INSTANCE.currentColorSelector != null && open) {