aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/hud
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/hud
parent174dcbf96f4715fe52a21ca8592d5d71b6fa4a8b (diff)
downloadOneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.tar.gz
OneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.tar.bz2
OneConfig-d69ef45507c8073ae656b171bea23a3063f8250f.zip
hud stuff
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/hud')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java25
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java2
2 files changed, 20 insertions, 7 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
index 12bc162..b15300e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
@@ -1,17 +1,23 @@
package cc.polyfrost.oneconfig.hud;
+import cc.polyfrost.oneconfig.lwjgl.OneColor;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import java.awt.*;
public abstract class BasicHud {
+ public boolean enabled = true;
+ public boolean rounded = false;
+ public boolean border = false;
+ public OneColor bgColor = new OneColor(0, 0, 0, 120);
+ public OneColor borderColor = new OneColor(0, 0, 0);
+ public float cornerRadius = 2;
+ public float borderSize = 2;
public double xUnscaled = 0;
public double yUnscaled = 0;
public float scale = 1;
- public int paddingX = 5;
- public int paddingY = 5;
- public boolean background = true;
- public boolean rounded = false;
+ public float paddingX = 5;
+ public float paddingY = 5;
public BasicHud parent;
public BasicHud childRight;
public BasicHud childBottom;
@@ -53,8 +59,15 @@ public abstract class BasicHud {
}
private void drawBackground(float x, float y, float width, float height, float scale) {
- RenderManager.setupAndDraw(true, (vg) -> RenderManager.drawRoundedRect(vg, x, y, (width + paddingX * scale),
- (height + paddingY * scale), new Color(0, 0, 0, 120).getRGB(), 2 * scale));
+ RenderManager.setupAndDraw(true, (vg) -> {
+ if (rounded) {
+ RenderManager.drawRoundedRect(vg, x, y, (width + paddingX * scale), (height + paddingY * scale), bgColor.getRGB(), cornerRadius * scale);
+ if (border) RenderManager.drawHollowRoundRect(vg, x - borderSize * scale, y - borderSize * scale, (width + paddingX * scale) + borderSize * scale, (height + paddingY * scale) + borderSize * scale, borderColor.getRGB(), cornerRadius * scale, borderSize * scale);
+ } else {
+ RenderManager.drawRect(vg, x, y, (width + paddingX * scale), (height + paddingY * scale), bgColor.getRGB());
+ if (border) RenderManager.drawHollowRoundRect(vg, x - borderSize * scale, y - borderSize * scale, (width + paddingX * scale) + borderSize * scale, (height + paddingY * scale) + borderSize * scale, borderColor.getRGB(), 0, borderSize * scale);
+ }
+ });
}
public float getXScaled(int screenWidth) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
index 50303be..08baaee 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
@@ -15,7 +15,7 @@ public class HudCore {
if (event.type != RenderGameOverlayEvent.ElementType.ALL || editing) return;
int[] sr = OneConfig.getScaledResolution();
for (BasicHud hud : huds) {
- hud.drawAll(hud.getXScaled(sr[0]), hud.getYScaled(sr[1]), hud.scale, true);
+ if(hud.enabled) hud.drawAll(hud.getXScaled(sr[0]), hud.getYScaled(sr[1]), hud.scale, true);
}
}
}