summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java8
-rw-r--r--core/src/ch/asynk/tankontank/game/hud/Msg.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index e4fae79..e2e0ae2 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -13,6 +13,7 @@ import ch.asynk.tankontank.engine.gfx.Image;
import ch.asynk.tankontank.game.hud.Bg;
import ch.asynk.tankontank.game.hud.Button;
import ch.asynk.tankontank.game.hud.Msg;
+import ch.asynk.tankontank.game.hud.Position;
import ch.asynk.tankontank.TankOnTank;
@@ -92,7 +93,12 @@ public class Hud implements Disposable
public void notify(String s)
{
- msg.write(s, 1);
+ msg.write(s, 1, Position.MIDDLE_CENTER);
+ }
+
+ public void notify(String s, Position position)
+ {
+ msg.write(s, 1, position);
}
private float setButton(Button btn, float x, float y)
diff --git a/core/src/ch/asynk/tankontank/game/hud/Msg.java b/core/src/ch/asynk/tankontank/game/hud/Msg.java
index 6aaff52..885b395 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Msg.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java
@@ -23,10 +23,12 @@ public class Msg extends Bg
this.font = font;
}
- public void write(String text, float duration)
+ public void write(String text, float duration, Position position)
{
TextBounds b = font.getBounds(text);
- write(text, ((Gdx.graphics.getWidth() - b.width) / 2), ((Gdx.graphics.getHeight() - b.height) / 2), duration, 10);
+ float w = b.width + (2 * padding);
+ float h = b.height + (2 * padding);
+ write(text, position.getX(w), position.getY(h), duration, 10);
}
public void write(String text, float x, float y, float duration, int padding)