diff options
author | syeyoung <cyong06@naver.com> | 2021-05-09 13:54:52 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-05-09 13:54:52 +0900 |
commit | c7543c833f9bf57c79f8f58c5c91beacb5d986f9 (patch) | |
tree | 76aba465eed5a57784d8413373608c6787605408 /src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java | |
parent | c4a55b2540bb79cf087040721fd3146a3fe9ae92 (diff) | |
download | Skyblock-Dungeons-Guide-c7543c833f9bf57c79f8f58c5c91beacb5d986f9.tar.gz Skyblock-Dungeons-Guide-c7543c833f9bf57c79f8f58c5c91beacb5d986f9.tar.bz2 Skyblock-Dungeons-Guide-c7543c833f9bf57c79f8f58c5c91beacb5d986f9.zip |
FIX TEXT FLASHING. BLEND GO BRRRRR
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, 9 insertions, 0 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 957a59b1..c26a1b21 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/gui/elements/MTextField.java @@ -25,7 +25,10 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL14; import java.awt.*; import java.awt.datatransfer.*; @@ -68,6 +71,9 @@ public class MTextField extends MPanel { clip(new ScaledResolution(mc), clip.x + 1, clip.y + 1, clip.width - 2, clip.height - 2); FontRenderer fr = mc.fontRendererObj; int y = (getBounds().height - fr.FONT_HEIGHT) / 2; + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); fr.drawString(text, 3 - xOffset, y, foreground.getRGB()); // draw selection if (isFocused) { @@ -75,6 +81,9 @@ public class MTextField extends MPanel { 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); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); fr.drawString(text.substring(selectionStart, selectionEnd), 3 + startX, y, foreground.getRGB()); } |