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/HudGui.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java12
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java1
5 files changed, 22 insertions, 21 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index f5b1d3f..fc90c01 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -1,13 +1,13 @@
package cc.polyfrost.oneconfig.gui;
-import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.hud.Hud;
+import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.internal.hud.HudCore;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
-import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
+import cc.polyfrost.oneconfig.libs.universal.UResolution;
import cc.polyfrost.oneconfig.libs.universal.UScreen;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -44,7 +44,7 @@ public class HudGui extends UScreen implements GuiPause {
}
for (Hud hud : HudCore.huds) {
- if (hud.enabled) processHud(matrixStack, hud, mouseX);
+ if (hud.isEnabled()) processHud(matrixStack, hud, mouseX);
}
}
@@ -128,7 +128,7 @@ public class HudGui extends UScreen implements GuiPause {
float width = editingHud.getWidth(editingHud.scale) + editingHud.paddingX * editingHud.scale;
ArrayList<Float> verticalLines = new ArrayList<>();
for (Hud hud : HudCore.huds) {
- if (!hud.enabled) continue;
+ if (!hud.isEnabled()) continue;
verticalLines.addAll(getXSnappingHud(hud));
}
getSpaceSnapping(verticalLines);
@@ -167,7 +167,7 @@ public class HudGui extends UScreen implements GuiPause {
float height = editingHud.getHeight(editingHud.scale) + editingHud.paddingY * editingHud.scale;
ArrayList<Float> horizontalLines = new ArrayList<>();
for (Hud hud : HudCore.huds) {
- if (!hud.enabled) continue;
+ if (!hud.isEnabled()) continue;
horizontalLines.addAll(getYSnappingHud(hud));
}
getSpaceSnapping(horizontalLines);
@@ -229,7 +229,7 @@ public class HudGui extends UScreen implements GuiPause {
}
editingHud = null;
for (Hud hud : HudCore.huds) {
- if (!hud.enabled) continue;
+ if (!hud.isEnabled()) continue;
if (mouseClickedHud(hud, (int) mouseX, (int) mouseY))
break;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 1095ae0..41d0b4f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -109,7 +109,8 @@ public class OneConfigGui extends UScreen implements GuiPause {
RenderManager.setAlpha(vg, 0.5f);
} else {
backArrow.disable(false);
- if (!backArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f);
+ if (!backArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0))
+ RenderManager.setAlpha(vg, 0.8f);
}
RenderManager.drawSvg(vg, SVGs.CARET_LEFT, x + 246, y + 22, 28, 28);
RenderManager.setAlpha(vg, 1f);
@@ -118,7 +119,8 @@ public class OneConfigGui extends UScreen implements GuiPause {
RenderManager.setAlpha(vg, 0.5f);
} else {
forwardArrow.disable(false);
- if (!forwardArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0)) RenderManager.setAlpha(vg, 0.8f);
+ if (!forwardArrow.isHovered() || Platform.getMousePlatform().isButtonDown(0))
+ RenderManager.setAlpha(vg, 0.8f);
}
RenderManager.drawSvg(vg, SVGs.CARET_RIGHT, x + 294, y + 22, 28, 28);
RenderManager.setAlpha(vg, 1f);
@@ -140,7 +142,7 @@ public class OneConfigGui extends UScreen implements GuiPause {
}
ScissorManager.scissor(vg, x + 224, y + 72, 1056, 728);
- Scissor blockedClicks = InputUtils.blockInputArea(x + 224, y, 1056,72);
+ Scissor blockedClicks = InputUtils.blockInputArea(x + 224, y, 1056, 72);
if (prevPage != null && animation != null) {
float pageProgress = animation.get(GuiUtils.getDeltaTime());
if (!animation.isReversed()) {
@@ -188,9 +190,7 @@ public class OneConfigGui extends UScreen implements GuiPause {
public void onKeyPressed(int keyCode, char typedChar, @Nullable UKeyboard.Modifiers modifiers) {
UKeyboard.allowRepeatEvents(true);
try {
- if (keyCode == 1 && currentPage.parents.size() > 1) {
- openPage(currentPage.parents.get(currentPage.parents.size() - 2));
- } else if (allowClose) super.onKeyPressed(keyCode, typedChar, modifiers);
+ if (allowClose) super.onKeyPressed(keyCode, typedChar, modifiers);
textInputField.keyTyped(typedChar, keyCode);
if (currentColorSelector != null) currentColorSelector.keyTyped(typedChar, keyCode);
currentPage.keyTyped(typedChar, keyCode);
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 ddcf6eb..fa48592 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
@@ -1,13 +1,13 @@
package cc.polyfrost.oneconfig.gui.elements.config;
import cc.polyfrost.oneconfig.config.annotations.Dropdown;
-import cc.polyfrost.oneconfig.internal.assets.Colors;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
+import cc.polyfrost.oneconfig.internal.assets.Colors;
+import cc.polyfrost.oneconfig.internal.assets.SVGs;
import cc.polyfrost.oneconfig.platform.Platform;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
-import cc.polyfrost.oneconfig.internal.assets.SVGs;
import cc.polyfrost.oneconfig.renderer.scissor.Scissor;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
@@ -43,8 +43,8 @@ public class ConfigDropdown extends BasicOption {
else hovered = InputUtils.isAreaHovered(x + 352, y, 640, 32) && isEnabled();
if (hovered && InputUtils.isClicked() || opened && InputUtils.isClicked(true) &&
- (size == 1 && !InputUtils.isAreaHovered(x + 224, y + 40, 256, options.length * 32) ||
- size == 2 && !InputUtils.isAreaHovered(x + 352, y + 40, 640, options.length * 32))) {
+ (size == 1 && !InputUtils.isAreaHovered(x + 224, y + 40, 256, options.length * 32, true) ||
+ size == 2 && !InputUtils.isAreaHovered(x + 352, y + 40, 640, options.length * 32, true))) {
opened = !opened;
backgroundColor.setPalette(opened ? ColorPalette.PRIMARY : ColorPalette.SECONDARY);
if (opened) inputScissor = InputUtils.blockAllInput();
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
index 552051f..054915c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
@@ -129,18 +129,18 @@ public class TextInputField extends BasicElement {
float width;
StringBuilder s = new StringBuilder();
if (multiLine) {
- wrappedText = TextUtils.wrapText(vg, input, this.width - 24, 14f, Fonts.REGULAR.font);
+ wrappedText = TextUtils.wrapText(vg, input, this.width - 24, 14f, Fonts.REGULAR);
lines = wrappedText.size();
if (!toggled) caretPos = wrappedText.get(wrappedText.size() - 1).length();
int caretLine = (int) MathUtils.clamp(getCaretLine(caretPos), 0, wrappedText.size() - 1);
- width = RenderManager.getTextWidth(vg, wrappedText.get(caretLine).substring(0, getLineCaret(caretPos, caretLine)), 14f, Fonts.REGULAR.font);
+ width = RenderManager.getTextWidth(vg, wrappedText.get(caretLine).substring(0, getLineCaret(caretPos, caretLine)), 14f, Fonts.REGULAR);
} else if (!password) {
- width = RenderManager.getTextWidth(vg, input.substring(0, caretPos), 14f, Fonts.REGULAR.font);
+ width = RenderManager.getTextWidth(vg, input.substring(0, caretPos), 14f, Fonts.REGULAR);
} else {
for (int i = 0; i < input.length(); i++) {
s.append("*");
}
- width = RenderManager.getTextWidth(vg, s.substring(0, caretPos), 14f, Fonts.REGULAR.font);
+ width = RenderManager.getTextWidth(vg, s.substring(0, caretPos), 14f, Fonts.REGULAR);
}
if (hovered) {
int state = Platform.getMousePlatform().getButtonState(0); //todo does this work
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
index 5f454f2..8a2e226 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -9,6 +9,7 @@ import cc.polyfrost.oneconfig.internal.assets.Colors;
import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
import cc.polyfrost.oneconfig.renderer.RenderManager;
+import cc.polyfrost.oneconfig.renderer.TextRenderer;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;