aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/gui')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigCheckbox.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigHeader.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigInfo.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java4
12 files changed, 26 insertions, 12 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 681db60..578fa35 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
@@ -94,7 +94,7 @@ public class ConfigButton extends BasicOption {
public void draw(long vg, int x, int y, InputHandler inputHandler) {
button.disable(!isEnabled());
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
- RenderManager.drawText(vg, name, x, y + 17, Colors.WHITE, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 17, nameColor, 14f, Fonts.MEDIUM);
button.draw(vg, x + (size == 1 ? 352 : 736), y, inputHandler);
RenderManager.setAlpha(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 6f3be32..34241a4 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
@@ -81,7 +81,7 @@ public class ConfigCheckbox extends BasicOption {
}
float percentOn = animation.get();
- RenderManager.drawText(vg, name, x + 32, y + 17, Colors.WHITE_90, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x + 32, y + 17, nameColor, 14f, Fonts.MEDIUM);
RenderManager.drawRoundedRect(vg, x, y + 4, 24, 24, color.getColor(hover, hover && Platform.getMousePlatform().isButtonDown(0)), 6f);
RenderManager.drawHollowRoundRect(vg, x, y + 4, 23.5f, 23.5f, Colors.GRAY_300, 6f, 1f); // the 0.5f is to make it look better ok
@@ -95,6 +95,11 @@ public class ConfigCheckbox extends BasicOption {
}
@Override
+ protected float getNameX(int x) {
+ return x + 32;
+ }
+
+ @Override
public int getHeight() {
return 32;
}
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 5e92ddc..20b58b3 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
@@ -76,7 +76,7 @@ public class ConfigColorElement extends BasicOption {
} catch (IllegalAccessException e) {
return;
}
- RenderManager.drawText(vg, name, x, y + 16, Colors.WHITE_90, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 16, nameColor, 14f, Fonts.MEDIUM);
if (!hexField.isToggled()) hexField.setInput("#" + color.getHex());
hexField.setErrored(false);
if (hexField.isToggled()) {
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 6dd463f..376817c 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
@@ -62,7 +62,7 @@ public class ConfigDropdown extends BasicOption {
@Override
public void draw(long vg, int x, int y, InputHandler inputHandler) {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
- RenderManager.drawText(vg, name, x, y + 16, Colors.WHITE_90, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 16, nameColor, 14f, Fonts.MEDIUM);
boolean hovered;
if (size == 1) hovered = inputHandler.isAreaHovered(x + 224, y, 256, 32) && isEnabled();
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 eb1dece..102eab3 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
@@ -69,7 +69,7 @@ public class ConfigDualOption extends BasicOption {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
boolean hoveredLeft = inputHandler.isAreaHovered(x + 226, y, 128, 32) && isEnabled();
boolean hoveredRight = inputHandler.isAreaHovered(x + 354, y, 128, 32) && isEnabled();
- RenderManager.drawText(vg, name, x, y + 16, Colors.WHITE_90, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 16, nameColor, 14f, Fonts.MEDIUM);
RenderManager.drawRoundedRect(vg, x + 226, y, 256, 32, Colors.GRAY_600, 12f);
RenderManager.drawRoundedRect(vg, x + posAnimation.get(), y + 2, 124, 28, Colors.PRIMARY_600, 10f);
if (!hoveredLeft && isEnabled()) RenderManager.setAlpha(vg, 0.8f);
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 5e9f27f..1f4d613 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
@@ -51,7 +51,7 @@ public class ConfigHeader extends BasicOption {
@Override
public void draw(long vg, int x, int y, InputHandler inputHandler) {
Scissor scissor = ScissorManager.scissor(vg, x, y, size == 1 ? 480 : 992, 32);
- RenderManager.drawText(vg, name, x, y + 17, Colors.WHITE_90, 24, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 17, nameColor, 24, Fonts.MEDIUM);
ScissorManager.resetScissor(vg, scissor);
}
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 94afaec..6e77481 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
@@ -55,7 +55,7 @@ public class ConfigInfo extends BasicOption {
public void draw(long vg, int x, int y, InputHandler inputHandler) {
Scissor scissor = ScissorManager.scissor(vg, x, y, size == 1 ? 448 : 960, 32);
RenderManager.drawInfo(vg, type, x, y + 4, 24);
- RenderManager.drawText(vg, name, x + 32, y + 18, Colors.WHITE_90, 14, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x + 32, y + 18, nameColor, 14, Fonts.MEDIUM);
ScissorManager.resetScissor(vg, scissor);
}
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 491a99c..1e94422 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
@@ -59,7 +59,7 @@ public class ConfigKeyBind extends BasicOption {
@Override
public void draw(long vg, int x, int y, InputHandler inputHandler) {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
- RenderManager.drawText(vg, name, x, y + 17, Colors.WHITE, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 17, nameColor, 14f, Fonts.MEDIUM);
OneKeyBind keyBind = getKeyBind();
String text = keyBind.getDisplay();
button.disable(!isEnabled());
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 a4088d9..56424bf 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
@@ -99,7 +99,7 @@ public class ConfigSlider extends BasicOption {
}
if (!inputField.isToggled()) inputField.setCurrentValue(value);
- RenderManager.drawText(vg, name, x, y + 17, Colors.WHITE_90, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 17, nameColor, 14f, Fonts.MEDIUM);
RenderManager.drawRoundedRect(vg, x + 352, y + 13, 512, 6, Colors.GRAY_300, 4f);
RenderManager.drawRoundedRect(vg, x + 352, y + 13, xCoordinate - x - 352, 6, Colors.PRIMARY_500, 4f);
if (step > 0) {
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 4ecc42b..a62afb7 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
@@ -71,7 +71,7 @@ public class ConfigSwitch extends BasicOption {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
RenderManager.drawRoundedRect(vg, x, y + 4, 42, 24, color.getColor(hovered, hovered && Platform.getMousePlatform().isButtonDown(0)), 12f);
RenderManager.drawRoundedRect(vg, x2, y + 7, 18, 18, Colors.WHITE, 9f);
- RenderManager.drawText(vg, name, x + 50, y + 17, Colors.WHITE, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x + 50, y + 17, nameColor, 14f, Fonts.MEDIUM);
if (inputHandler.isAreaClicked(x, y, 42, 32) && isEnabled()) {
toggled = !toggled;
@@ -88,6 +88,11 @@ public class ConfigSwitch extends BasicOption {
}
@Override
+ protected float getNameX(int x) {
+ return x + 50;
+ }
+
+ @Override
public int getHeight() {
return 32;
}
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 4dc497b..a922e11 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
@@ -45,7 +45,7 @@ public class ConfigTextBox extends BasicOption {
private final TextInputField textField;
public ConfigTextBox(Field field, Object parent, String name, String description, String category, String subcategory, int size, String placeholder, boolean secure, boolean multiLine) {
- super(field, parent, name, category, description, subcategory, size);
+ super(field, parent, name, description, category, subcategory, size);
this.secure = secure;
this.multiLine = multiLine;
this.textField = new TextInputField(size == 1 ? 256 : 640, multiLine ? 64 : 32, placeholder, multiLine, secure);
@@ -60,7 +60,7 @@ public class ConfigTextBox extends BasicOption {
public void draw(long vg, int x, int y, InputHandler inputHandler) {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
textField.disable(!isEnabled());
- RenderManager.drawText(vg, name, x, y + 16, Colors.WHITE_90, 14, Fonts.MEDIUM);
+ RenderManager.drawText(vg, name, x, y + 16, nameColor, 14, Fonts.MEDIUM);
try {
String value = (String) get();
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
index ec1e4a1..4de3d49 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -32,6 +32,7 @@ import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
+import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputHandler;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
@@ -76,9 +77,12 @@ public class ModConfigPage extends Page {
for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) {
optionY += subCategory.draw(vg, x + 30, optionY, inputHandler);
}
+ ScissorManager.save();
+ ScissorManager.clearScissors(vg);
for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) {
subCategory.drawLast(vg, x + 30, inputHandler);
}
+ ScissorManager.restore(vg);
totalSize = optionY - y;
}