From 9a3d070d80d569bea3f1b6b162bb061a7d9446db Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 24 Apr 2022 14:46:02 +0200 Subject: childing in huds --- .../java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java') 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 5044421..e9e3a59 100644 --- a/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java +++ b/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java @@ -58,6 +58,11 @@ public abstract class BasicHud { } public float getXScaled(int screenWidth) { + if (parent != null && parent.childRight == this) { + return parent.getXScaled(screenWidth) + parent.getWidth(parent.scale) + parent.paddingX * parent.scale / 2f; + } else if (parent != null) { + return parent.getXScaled(screenWidth); + } if (xUnscaled <= 0.5) { return (int) (screenWidth * xUnscaled); } @@ -65,6 +70,11 @@ public abstract class BasicHud { } public float getYScaled(int screenHeight) { + if (parent != null && parent.childBottom == this) { + return parent.getYScaled(screenHeight) + parent.getHeight(parent.scale) + parent.paddingY * parent.scale / 2f; + } else if (parent != null) { + return parent.getYScaled(screenHeight); + } if (yUnscaled <= 0.5) { return (int) (screenHeight * yUnscaled); } -- cgit