aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/lwjgl
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-12 19:07:05 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-12 19:07:05 +0200
commitd69ef45507c8073ae656b171bea23a3063f8250f (patch)
treefdaa1098555c7ced9c72fe5064c232d05125458a /src/main/java/cc/polyfrost/oneconfig/lwjgl
parent174dcbf96f4715fe52a21ca8592d5d71b6fa4a8b (diff)
downloadOneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.tar.gz
OneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.tar.bz2
OneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.zip
hud stuff
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java23
2 files changed, 6 insertions, 25 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
index e098390..508fc21 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
@@ -16,7 +16,7 @@ import java.awt.*;
*/
@SuppressWarnings("unused")
public class OneColor {
- transient private int rgba;
+ transient private Integer rgba = null;
private short[] hsba;
private int chroma = -1;
@@ -134,13 +134,17 @@ public class OneColor {
*/
public int getRGB() {
if (chroma == -1) {
+ // fix for when rgba is not set because of deserializing not calling constructor
+ if (rgba == null) rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
return rgba;
} else {
return HSBAtoRGBA(System.currentTimeMillis() % chroma / (float) chroma, hsba[1], hsba[2], hsba[3]);
}
}
- /** return the current color without its alpha. Internal method. */
+ /**
+ * return the current color without its alpha. Internal method.
+ */
public int getRGBNoAlpha() {
return 0xff000000 | rgba;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index 0a9ccce..d23f1dd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -324,29 +324,6 @@ public final class RenderManager {
GL11.glColor4f(f1, f2, f3, f);
}
- public static void drawDottedLine(float sx, float sy, float ex, float ey, int width, int factor, int color) {
- GL11.glPushMatrix();
- GL11.glLineStipple(factor, (short) 0xAAAA);
- GL11.glEnable(GL11.GL_LINE_STIPPLE);
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_TEXTURE_2D);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glDisable(GL11.GL_ALPHA);
- GL14.glBlendFuncSeparate(770, 771, 1, 0); // this should never fail because it's a GL14 call, and we import GL31
- glColor(color);
- GL11.glLineWidth(width);
- GL11.glBegin(GL11.GL_LINES);
- GL11.glVertex2d(sx, sy);
- GL11.glVertex2d(ex, ey);
- GL11.glEnd();
- GL11.glDisable(GL11.GL_BLEND);
- GL11.glEnable(GL11.GL_ALPHA);
- GL11.glEnable(GL11.GL_TEXTURE_2D);
- GL11.glPopMatrix();
- GL11.glDisable(GL11.GL_LINE_STIPPLE);
- GL11.glPopMatrix();
- }
-
public static void drawGlRect(int x, int y, int width, int height, int color) {
Gui.drawRect(x, y, x + width, y + height, color);
}