aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-18 18:35:21 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-18 18:35:21 +0200
commit420ca8641b6204b011ee74916c839de54d0b2104 (patch)
tree3874cdce63a4becbcf77863919388b157ee94d08 /src/main/java
parent01c2733db797fc1bb88cee627f792d05ab00f379 (diff)
downloadOneConfig-420ca8641b6204b011ee74916c839de54d0b2104.tar.gz
OneConfig-420ca8641b6204b011ee74916c839de54d0b2104.tar.bz2
OneConfig-420ca8641b6204b011ee74916c839de54d0b2104.zip
make lwjgl work on non-windows machines
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java34
1 files changed, 31 insertions, 3 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java
index e4bfd65..f43a79e 100644
--- a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java
+++ b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java
@@ -31,13 +31,17 @@ public abstract class BasicHud {
}
public void drawAll(float x, float y, float scale) {
- drawBackground(x, y, getWidth(scale), getHeight(scale), scale);
+ drawBackground(x, y, getTotalWidth(scale), getTotalHeight(scale), scale);
draw((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
+ if (childRight != null) childRight.draw((int) x, (int) y, scale);
+ if (childBottom != null) childBottom.draw((int) x, (int) y, scale);
}
public void drawExampleAll(float x, float y, float scale) {
- drawBackground(x, y, getExampleWidth(scale), getExampleHeight(scale), scale);
+ drawBackground(x, y, getTotalExampleWidth(scale), getTotalHeight(scale), scale);
drawExample((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
+ if (childRight != null) childRight.drawExample((int) x, (int) y, scale);
+ if (childBottom != null) childBottom.drawExample((int) x, (int) y, scale);
}
public void drawExample(int x, int y, float scale) {
@@ -64,6 +68,30 @@ public abstract class BasicHud {
}
public float getTotalWidth(float scale) {
- return 0;
+ float width = getWidth(scale);
+ if (childBottom != null) width += childBottom.getTotalWidth(scale);
+ if (childRight != null) width += childRight.getTotalWidth(scale);
+ return width;
+ }
+
+ public float getTotalHeight(float scale) {
+ float height = getHeight(scale);
+ if (childBottom != null) height += childBottom.getTotalHeight(scale);
+ if (childRight != null) height += childRight.getTotalHeight(scale);
+ return height;
+ }
+
+ public float getTotalExampleWidth(float scale) {
+ float width = getExampleWidth(scale);
+ if (childBottom != null) width += childBottom.getTotalExampleWidth(scale);
+ if (childRight != null) width += childRight.getTotalExampleWidth(scale);
+ return width;
+ }
+
+ public float getTotalExampleHeight(float scale) {
+ float height = getExampleHeight(scale);
+ if (childBottom != null) height += childBottom.getTotalExampleHeight(scale);
+ if (childRight != null) height += childRight.getTotalExampleHeight(scale);
+ return height;
}
} \ No newline at end of file