diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 23:19:37 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-09 23:19:37 +0100 |
commit | 099c7bcbbd7f00e8d32917c552ee9e3a1e6125ff (patch) | |
tree | fe68213f36691b8cf6e9814c30edcc1014bf4fd0 /core/src/ch/asynk/rustanddust | |
parent | 47dddb62b66d943b8c77a0dcb868c68516063ada (diff) | |
download | RustAndDust-099c7bcbbd7f00e8d32917c552ee9e3a1e6125ff.zip RustAndDust-099c7bcbbd7f00e8d32917c552ee9e3a1e6125ff.tar.gz |
Label: must update width and height before calling setPosition(Position)
Diffstat (limited to 'core/src/ch/asynk/rustanddust')
-rw-r--r-- | core/src/ch/asynk/rustanddust/ui/Label.java | 8 |
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) { |