diff options
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/elements')
3 files changed, 17 insertions, 5 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java index 6f3c1b4..ef0b5a0 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java @@ -52,6 +52,10 @@ public class TextInputField extends BasicElement { this.password = password; } + public boolean getPassword() { + return password; + } + @Override public void draw(long vg, int x, int y) { this.x = x; diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java index 5386fc9..65be59f 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigPage.java @@ -27,18 +27,18 @@ public class ConfigPage extends BasicOption { @Override public void draw(long vg, int x, int y) { int height = description.equals("") ? 64 : 96; - NanoVG.nvgScissor(vg, x - 2, y, 1024, height); + NanoVG.nvgScissor(vg, x - 16, y, 1024, height); boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1024, height); boolean clicked = InputUtils.isAreaClicked(x - 2, y, 1024, height); backgroundColor = ColorUtils.smoothColor(backgroundColor, OneConfigConfig.GRAY_500, OneConfigConfig.GRAY_400, hovered, 100); if (clicked) NanoVG.nvgGlobalAlpha(vg, 0.8f); - RenderManager.drawRoundedRect(vg, x - 2, y, 1024, height, backgroundColor, 20); - RenderManager.drawString(vg, name, x + 24, y + 32, OneConfigConfig.WHITE, 24, Fonts.INTER_MEDIUM); + RenderManager.drawRoundedRect(vg, x - 16, y, 1024, height, backgroundColor, 20); + RenderManager.drawString(vg, name, x + 10, y + 32, OneConfigConfig.WHITE, 24, Fonts.INTER_MEDIUM); if (!description.equals("")) - RenderManager.drawString(vg, name, x + 24, y + 70, OneConfigConfig.WHITE, 14, Fonts.INTER_MEDIUM); - RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 995f, y + (description.equals("") ? 20f : 36f), 13, 22); + RenderManager.drawString(vg, name, x + 10, y + 70, OneConfigConfig.WHITE, 14, Fonts.INTER_MEDIUM); + RenderManager.drawImage(vg, "/assets/oneconfig/textures/arrow.png", x + 981f, y + (description.equals("") ? 20f : 36f), 13, 22); if (clicked) OneConfigGui.INSTANCE.openPage(new ModConfigPage(page)); NanoVG.nvgGlobalAlpha(vg, 1f); diff --git a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java index 8b96df1..4d44701 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/config/ConfigTextBox.java @@ -5,6 +5,7 @@ import io.polyfrost.oneconfig.config.interfaces.BasicOption; import io.polyfrost.oneconfig.gui.elements.TextInputField; import io.polyfrost.oneconfig.lwjgl.RenderManager; import io.polyfrost.oneconfig.lwjgl.font.Fonts; +import io.polyfrost.oneconfig.utils.InputUtils; import org.lwjgl.nanovg.NanoVG; import java.lang.reflect.Field; @@ -34,11 +35,18 @@ public class ConfigTextBox extends BasicOption { NanoVG.nvgResetScissor(vg); textField.draw(vg, x + (size == 1 && hasHalfSize() ? 224 : 352), y); + + if (secure) RenderManager.drawImage(vg, "/assets/oneconfig/textures/eye.png", x + 967, y + 7, 18, 18); + if (secure && InputUtils.isAreaClicked(x + 967, y + 7, 18, 18)) textField.setPassword(!textField.getPassword()); } @Override public void keyTyped(char key, int keyCode) { textField.keyTyped(key, keyCode); + try { + set(textField.getInput()); + } catch (IllegalAccessException ignored) { + } } @Override |