summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-01 23:38:05 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-01 23:38:05 +0100
commitdaddc5d539c3e137da8ac6769c24072c057c120c (patch)
treeda1ba703b188df78412a66d444e09e85dd7c2c5e
parentfc1d6b90a218fd7072206e6e693e8cd8ac105e2f (diff)
downloadRustAndDust-daddc5d539c3e137da8ac6769c24072c057c120c.zip
RustAndDust-daddc5d539c3e137da8ac6769c24072c057c120c.tar.gz
Msg: add getX() getX() setPosition(float, float, int) write(String, float)
-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;