diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-03 17:38:50 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-05-03 17:38:50 +0200 |
commit | b798930b21b89b81be05a31281f768667a6dd7f3 (patch) | |
tree | 8611e7a51f65910da99b22034f078c23b13f8546 /src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java | |
parent | e5ef86b9b3fd0f5e687416acc667f368444e4459 (diff) | |
download | OneConfig-b798930b21b89b81be05a31281f768667a6dd7f3.tar.gz OneConfig-b798930b21b89b81be05a31281f768667a6dd7f3.tar.bz2 OneConfig-b798930b21b89b81be05a31281f768667a6dd7f3.zip |
multiple scissors system
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java | 7 |
1 files changed, 4 insertions, 3 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 04e5676..1e33008 100644 --- a/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java +++ b/src/main/java/io/polyfrost/oneconfig/gui/elements/TextInputField.java @@ -2,6 +2,8 @@ package io.polyfrost.oneconfig.gui.elements; import io.polyfrost.oneconfig.config.OneConfigConfig; import io.polyfrost.oneconfig.lwjgl.RenderManager; +import io.polyfrost.oneconfig.lwjgl.Scissor; +import io.polyfrost.oneconfig.lwjgl.ScissorManager; import io.polyfrost.oneconfig.lwjgl.font.Fonts; import io.polyfrost.oneconfig.utils.InputUtils; import net.minecraft.client.gui.GuiScreen; @@ -84,6 +86,7 @@ public class TextInputField extends BasicElement { this.y = y; this.vg = vg; try { + Scissor scissor = ScissorManager.scissor(vg, x, y, width, height); int colorOutline = errored ? OneConfigConfig.ERROR_700 : OneConfigConfig.GRAY_700; RenderManager.drawHollowRoundRect(vg, x, y, width, height, colorOutline, 12f, 2f); super.update(x, y); @@ -179,6 +182,7 @@ public class TextInputField extends BasicElement { } else { RenderManager.drawString(vg, s.toString(), x + 12, y + height / 2f + 1, color, 14f, Fonts.INTER_REGULAR); } + ScissorManager.resetScissor(vg, scissor); } catch (Exception e) { e.printStackTrace(); } @@ -334,9 +338,6 @@ public class TextInputField extends BasicElement { if (!Character.isDefined(c)) return; if (GuiScreen.isCtrlKeyDown()) return; if (ChatAllowedCharacters.isAllowedCharacter(c)) { - if (getTextWidth(vg, input) + 22 > width) { // over typing is banned - return; - } if (selectedText != null) { if (caretPos > prevCaret) { input = input.substring(0, prevCaret) + input.substring(prevCaret, caretPos); |