aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-26 13:04:43 +0200
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-01-26 13:04:43 +0200
commit6cb43704d06df2177e188c090a652f7e4f80a661 (patch)
tree3c95c214c54c2f4e6276486a9b40d6858c99c338 /src/main/java/io
parent0db57038b6aa6622ff4078e4c3c33dbc6f98c4b4 (diff)
downloadLibGui-6cb43704d06df2177e188c090a652f7e4f80a661.tar.gz
LibGui-6cb43704d06df2177e188c090a652f7e4f80a661.tar.bz2
LibGui-6cb43704d06df2177e188c090a652f7e4f80a661.zip
Add a utility method to CottonHud that resizes the added widget
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
index 8eb5f42..a9d1d9b 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonHud.java
@@ -45,6 +45,21 @@ public enum CottonHud implements HudRenderCallback {
}
/**
+ * Adds a new widget to the HUD at the specified offsets and resizes it.
+ *
+ * @param widget the widget
+ * @param x the x offset
+ * @param y the y offset
+ * @param width the width of the widget
+ * @param height the heigh of the widget
+ * @see Positioner#of documentation about the offsets
+ */
+ public void add(WWidget widget, int x, int y, int width, int height) {
+ add(widget, Positioner.of(x, y));
+ widget.setSize(width, height);
+ }
+
+ /**
* Adds a new widget to the HUD with a custom positioner.
*
* @param widget the widget