aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements/config
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-11 14:06:08 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-11 14:06:08 +0200
commit744e295d86805955194d8b203e5e5dbffe1228fd (patch)
tree600cea13f18a8c6f9b2a6d22e4522e6b03cf0d72 /src/main/java/cc/polyfrost/oneconfig/gui/elements/config
parentc0b24f80a50d1c5968bbda16a555e9aa94707112 (diff)
downloadOneConfig-744e295d86805955194d8b203e5e5dbffe1228fd.tar.gz
OneConfig-744e295d86805955194d8b203e5e5dbffe1228fd.tar.bz2
OneConfig-744e295d86805955194d8b203e5e5dbffe1228fd.zip
implement alpha things
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.java12
1 files changed, 6 insertions, 6 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 581babd..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,26 +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 isAlphaAllowed;
+ 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);
- isAlphaAllowed = 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() || isAlphaAllowed);
+ alphaField.disable(!isEnabled() || allowAlpha);
element.disable(!isEnabled());
int x1 = size == 1 ? x : x + 512;
@@ -87,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) {