summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/ui/Label.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/Label.java b/core/src/ch/asynk/rustanddust/ui/Label.java
index 6a6d809..1bff1ba 100644
--- a/core/src/ch/asynk/rustanddust/ui/Label.java
+++ b/core/src/ch/asynk/rustanddust/ui/Label.java
@@ -54,6 +54,7 @@ public class Label extends Widget
public void write(String text)
{
this.text = text;
+ compute();
setPosition(position);
}
@@ -63,6 +64,13 @@ public class Label extends Widget
setPosition(x, y);
}
+ private void compute()
+ {
+ this.layout.setText(font, (text == null) ? "" : text);
+ this.rect.width = (layout.width + (2 * padding));
+ this.rect.height = (layout.height + (2 * padding));
+ }
+
@Override
public void draw(Batch batch)
{