aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-24 14:46:02 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-04-24 14:46:02 +0200
commit9a3d070d80d569bea3f1b6b162bb061a7d9446db (patch)
tree78dfc45da2c2d147794a923acdcb824cf6b01fec /src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java
parent2b38d2d62391428a7fa40f268a4e65f876dd0e75 (diff)
downloadOneConfig-9a3d070d80d569bea3f1b6b162bb061a7d9446db.tar.gz
OneConfig-9a3d070d80d569bea3f1b6b162bb061a7d9446db.tar.bz2
OneConfig-9a3d070d80d569bea3f1b6b162bb061a7d9446db.zip
childing in huds
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/hud/interfaces/BasicHud.java10
1 files changed, 10 insertions, 0 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 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);
}