diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-18 18:35:21 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2022-04-18 18:35:21 +0200 |
commit | 420ca8641b6204b011ee74916c839de54d0b2104 (patch) | |
tree | 3874cdce63a4becbcf77863919388b157ee94d08 /src/main | |
parent | 01c2733db797fc1bb88cee627f792d05ab00f379 (diff) | |
download | OneConfig-420ca8641b6204b011ee74916c839de54d0b2104.tar.gz OneConfig-420ca8641b6204b011ee74916c839de54d0b2104.tar.bz2 OneConfig-420ca8641b6204b011ee74916c839de54d0b2104.zip |
make lwjgl work on non-windows machines
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java | 34 |
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 |