aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2021-11-16 21:45:39 +0200
committerJuuz <6596629+Juuxel@users.noreply.github.com>2021-11-16 21:45:39 +0200
commit9703a49ce7418a164323e4fd775ade1854b86887 (patch)
tree1159e36cbd0065c27146404265d85c4335f336f3 /src
parente97b093c21755a44474fa0d43e4dca2d275de499 (diff)
downloadLibGui-9703a49ce7418a164323e4fd775ade1854b86887.tar.gz
LibGui-9703a49ce7418a164323e4fd775ade1854b86887.tar.bz2
LibGui-9703a49ce7418a164323e4fd775ade1854b86887.zip
Fix title alignments when titleX is not 0
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
index 331f68b..1751d4d 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
@@ -24,6 +24,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
/**
* The X coordinate of the screen title.
+ * This is relative to the root panel's top-left corner.
*
* @since 2.0.0
*/
@@ -31,6 +32,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
/**
* The Y coordinate of the screen title.
+ * This is relative to the root panel's top-left corner.
*
* @since 2.0.0
*/
@@ -126,7 +128,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
if (getTitle() != null && description.isTitleVisible()) {
int width = description.getRootPanel().getWidth();
- ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width, description.getTitleColor());
+ ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), left + titleX, top + titleY, width - titleX, description.getTitleColor());
}
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
index 82d8d4b..96da107 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
@@ -276,7 +276,7 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
if (description != null && description.isTitleVisible()) {
int width = description.getRootPanel().getWidth();
- ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), titleX, titleY, width, description.getTitleColor());
+ ScreenDrawing.drawString(matrices, getTitle().asOrderedText(), description.getTitleAlignment(), titleX, titleY, width - titleX, description.getTitleColor());
}
// Don't draw the player inventory label as it's drawn by the widget itself