From 92ce9024b73df31f3c88ad23a7443dec2578469c Mon Sep 17 00:00:00 2001 From: syeyoung Date: Wed, 10 Mar 2021 23:06:05 +0900 Subject: finally fix gui flashing issue. --- .../java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java') 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; } } -- cgit