diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2019-12-18 13:01:23 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2019-12-18 13:01:23 +0100 |
commit | 2349d0ac3ae59109099bba02fc491284d566e024 (patch) | |
tree | aafe652a2ec54ab8a3661f4db61f8b94da6e2071 /core/src/ch/asynk/gdx/boardgame | |
parent | 29400f6c52d22198a2d78b9a50f12937082d004d (diff) | |
download | gdx-boardgame-2349d0ac3ae59109099bba02fc491284d566e024.zip gdx-boardgame-2349d0ac3ae59109099bba02fc491284d566e024.tar.gz |
ui.Label : code factorisation
Diffstat (limited to 'core/src/ch/asynk/gdx/boardgame')
-rw-r--r-- | core/src/ch/asynk/gdx/boardgame/ui/Label.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/ui/Label.java b/core/src/ch/asynk/gdx/boardgame/ui/Label.java index 10b7c50..4d89ffa 100644 --- a/core/src/ch/asynk/gdx/boardgame/ui/Label.java +++ b/core/src/ch/asynk/gdx/boardgame/ui/Label.java @@ -31,26 +31,25 @@ public class Label extends Element this.layout = new GlyphLayout(); } - public void setFont(BitmapFont font) + public String getText() { - this.font = font; - this.layout.setText(font, (text == null) ? "" : text); - taint(); + return text; } - public String getText() + public void setFont(BitmapFont font) { - return text; + this.font = font; + write(); } public void write(String text) { - write(text, getX(), getY()); + this.text = text; + write(); } - public void write(String text, float x, float y) + public void write() { - this.text = text; this.layout.setText(font, (text == null) ? "" : text); taint(); } |