diff options
author | syeyoung <cyong06@naver.com> | 2021-03-10 23:06:05 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-03-10 23:06:05 +0900 |
commit | 92ce9024b73df31f3c88ad23a7443dec2578469c (patch) | |
tree | dd7f6c928c79e2847a34ccb47820a037d244e361 /src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java | |
parent | a7030786cc5f3b756f8b538f8f071cd7d5c14e77 (diff) | |
download | Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.gz Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.tar.bz2 Skyblock-Dungeons-Guide-92ce9024b73df31f3c88ad23a7443dec2578469c.zip |
finally fix gui flashing issue.
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java')
-rwxr-xr-x | src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java index d3f2b2c0..8c5ce1c8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java @@ -1,6 +1,7 @@ package kr.syeyoung.dungeonsguide.gui.elements; import kr.syeyoung.dungeonsguide.gui.MPanel; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -42,8 +43,8 @@ public class MTextField extends MPanel { @Override public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle clip) { - Gui.drawRect(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); - Gui.drawRect(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB()); + RenderUtils.drawRectSafe(0,0,getBounds().width, getBounds().height, isFocused ? Color.white.getRGB() : Color.gray.getRGB()); + RenderUtils.drawRectSafe(1,1,getBounds().width - 1, getBounds().height - 1, Color.black.getRGB()); Minecraft mc = Minecraft.getMinecraft(); clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); @@ -55,7 +56,7 @@ public class MTextField extends MPanel { if (selectionStart != -1) { int startX = fr.getStringWidth(text.substring(0, selectionStart)) - xOffset; int endX = fr.getStringWidth(text.substring(0, selectionEnd)) - xOffset; - Gui.drawRect(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00); + RenderUtils.drawRectSafe(3 + startX, y, 3 + endX, y + fr.FONT_HEIGHT, 0xFF00FF00); fr.drawString(text.substring(selectionStart, selectionEnd), 3 + startX, y, foreground.getRGB()); } @@ -65,7 +66,7 @@ public class MTextField extends MPanel { int x = fr.getStringWidth(text.substring(0, cursor)) - xOffset; cursorBlickTicker++; if (cursorBlickTicker < 10) - Gui.drawRect(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF); + RenderUtils.drawRectSafe(3 + x, y, 4 + x, y + fr.FONT_HEIGHT, 0xFFFFFFFF); if (cursorBlickTicker == 20) cursorBlickTicker = 0; } } |