summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/rustanddust/ui/LabelImage.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2015-07-19 13:20:33 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2015-07-19 13:20:33 +0200
commitde0463bcf0f76ef8b07f2719679c9e0d72745c5d (patch)
tree9a33df947ceeea16a3e20b400585b1d3c304e77e /core/src/ch/asynk/rustanddust/ui/LabelImage.java
parente66f9f2a61d3dab4545e996046486de0d44e2901 (diff)
downloadRustAndDust-de0463bcf0f76ef8b07f2719679c9e0d72745c5d.zip
RustAndDust-de0463bcf0f76ef8b07f2719679c9e0d72745c5d.tar.gz
welcome RustAndDust
Diffstat (limited to 'core/src/ch/asynk/rustanddust/ui/LabelImage.java')
-rw-r--r--core/src/ch/asynk/rustanddust/ui/LabelImage.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/ui/LabelImage.java b/core/src/ch/asynk/rustanddust/ui/LabelImage.java
new file mode 100644
index 0000000..0fb6ecb
--- /dev/null
+++ b/core/src/ch/asynk/rustanddust/ui/LabelImage.java
@@ -0,0 +1,72 @@
+package ch.asynk.rustanddust.ui;
+
+import com.badlogic.gdx.graphics.g2d.Batch;
+import com.badlogic.gdx.graphics.g2d.BitmapFont;
+import com.badlogic.gdx.graphics.g2d.TextureRegion;
+import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
+
+public class LabelImage extends Bg
+{
+ private Label label;
+
+ public LabelImage(TextureRegion region, BitmapFont font)
+ {
+ this(region, font, 0f);
+ }
+
+ public LabelImage(TextureRegion region, BitmapFont font, float padding)
+ {
+ this(region, font, padding, Position.MIDDLE_CENTER);
+ }
+
+ public LabelImage(TextureRegion region, BitmapFont font, float padding, Position position)
+ {
+ super(region);
+ this.label = new Label(font, padding, position);
+ }
+
+ @Override
+ public void dispose()
+ {
+ label.dispose();
+ }
+
+ @Override
+ public void translate(float dx, float dy)
+ {
+ super.translate(dx, dy);
+ label.translate(dx, dy);
+ }
+
+ public void setPosition(float x, float y)
+ {
+ super.setPosition(x, y);
+ label.setPosition(x, y);
+ }
+
+ public void setLabelPosition(Position position)
+ {
+ label.setPosition(position, this);
+ }
+
+ public void write(String text)
+ {
+ this.label.write(text);
+ }
+
+ @Override
+ public void draw(Batch batch)
+ {
+ if (!visible) return;
+ super.draw(batch);
+ label.draw(batch);
+ }
+
+ @Override
+ public void drawDebug(ShapeRenderer shapes)
+ {
+ if (!visible) return;
+ super.drawDebug(shapes);
+ label.drawDebug(shapes);
+ }
+}