diff options
author | nextdaydelivery <12willettsh@gmail.com> | 2022-02-19 15:10:17 +0000 |
---|---|---|
committer | nextdaydelivery <12willettsh@gmail.com> | 2022-02-19 15:10:17 +0000 |
commit | 8dbf57afea03a33b5648e77823e4948abdf3ba4f (patch) | |
tree | 090513b61908d3b74caf99629c44fc5fb50f48f2 /src/main/java/io/polyfrost/oneconfig/renderer | |
parent | 3000dd17a482843ccf320d594d2dd39eb59145e8 (diff) | |
download | OneConfig-8dbf57afea03a33b5648e77823e4948abdf3ba4f.tar.gz OneConfig-8dbf57afea03a33b5648e77823e4948abdf3ba4f.tar.bz2 OneConfig-8dbf57afea03a33b5648e77823e4948abdf3ba4f.zip |
finish theme stuff, do some window stuff and add colored text
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/renderer')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java b/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java index 52025da..452bc48 100644 --- a/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java +++ b/src/main/java/io/polyfrost/oneconfig/renderer/TrueTypeFont.java @@ -5,13 +5,11 @@ import org.lwjgl.BufferUtils; import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.GLU; -import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.awt.image.DataBuffer; import java.awt.image.DataBufferByte; import java.awt.image.DataBufferInt; -import java.io.File; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.IntBuffer; @@ -270,12 +268,16 @@ public class TrueTypeFont { return fontHeight; } - public void drawString(String text, float x, float y, float scaleX, float scaleY) { - drawString(text, x, y, scaleX, scaleY, ALIGN_LEFT); + public void drawString(String text, float x, float y, float scaleX, float scaleY, int color) { + drawString(text, x, y, scaleX, scaleY, ALIGN_LEFT, color); } - public void drawString(String text, float x, float y, float scaleX, float scaleY, int format) { + public void drawString(String text, float x, float y, float scaleX, float scaleY, int format, int color) { + float f = (float) (color >> 16 & 255) / 255.0F; + float f1 = (float) (color >> 8 & 255) / 255.0F; + float f3 = (float) (color >> 24 & 255) / 255.0F; + float f2 = (float) (color & 255) / 255.0F; int startIndex = 0; int endIndex = text.length() - 1; IntObject intObject; @@ -322,6 +324,7 @@ public class TrueTypeFont { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); + GlStateManager.color(f, f1, f2, f3); while (i >= startIndex && i <= endIndex) { charCurrent = text.charAt(i); if (charCurrent < 256) { @@ -358,6 +361,7 @@ public class TrueTypeFont { i += d; } GlStateManager.disableBlend(); + GlStateManager.color(1f,1f,1f,1f); } public static int loadImage(BufferedImage bufferedImage) { @@ -397,7 +401,7 @@ public class TrueTypeFont { int internalFormat = GL11.GL_RGBA8, format = GL11.GL_RGBA; IntBuffer textureId = BufferUtils.createIntBuffer(1); - ; + GL11.glGenTextures(textureId); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureId.get(0)); |