summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Msg.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/hud/Msg.java b/core/src/ch/asynk/tankontank/game/hud/Msg.java
index 0dcd3e7..a4d5a4b 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Msg.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java
@@ -33,6 +33,16 @@ public class Msg extends Bg
private boolean visible;
private ArrayDeque<MsgInfo> stack;
+ public float getX()
+ {
+ return x;
+ }
+
+ public float getY()
+ {
+ return y;
+ }
+
public Msg(BitmapFont font, TextureRegion region)
{
super(region);
@@ -58,6 +68,23 @@ public class Msg extends Bg
write(text, position.getX(w), position.getY(h), duration, 10);
}
+ public void setPosition(float x, float y, int padding)
+ {
+ this.x = x;
+ this.y = y;
+ this.padding = padding;
+ }
+
+ public void write(String text, float duration)
+ {
+ this.text = text;
+ this.duration = duration;
+ this.visible = true;
+ this.elapsed = 0f;
+ TextBounds b = font.getBounds(text);
+ set(x, y, (b.width + (padding * 2)), (b.height + (padding * 2)));
+ }
+
public void write(String text, float x, float y, float duration, int padding)
{
this.text = text;