diff options
-rw-r--r-- | build.gradle | 8 | ||||
-rw-r--r-- | src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java | 34 |
2 files changed, 39 insertions, 3 deletions
diff --git a/build.gradle b/build.gradle index 35e80c1..1a9ff06 100644 --- a/build.gradle +++ b/build.gradle @@ -82,6 +82,14 @@ dependencies { lwjglNative "org.lwjgl:lwjgl-stb:3.3.0:natives-windows" lwjglNative "org.lwjgl:lwjgl-tinyfd:3.3.0:natives-windows" lwjglNative "org.lwjgl:lwjgl-nanovg:3.3.0:natives-windows" + lwjglNative "org.lwjgl:lwjgl:3.3.0:natives-linux" + lwjglNative "org.lwjgl:lwjgl-stb:3.3.0:natives-linux" + lwjglNative "org.lwjgl:lwjgl-tinyfd:3.3.0:natives-linux" + lwjglNative "org.lwjgl:lwjgl-nanovg:3.3.0:natives-linux" + lwjglNative "org.lwjgl:lwjgl:3.3.0:natives-macos" + lwjglNative "org.lwjgl:lwjgl-stb:3.3.0:natives-macos" + lwjglNative "org.lwjgl:lwjgl-tinyfd:3.3.0:natives-macos" + lwjglNative "org.lwjgl:lwjgl-nanovg:3.3.0:natives-macos" implementation lwjglJar.outputs.files } 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 |