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.java7
1 files changed, 7 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 c5b72b5..6aaff52 100644
--- a/core/src/ch/asynk/tankontank/game/hud/Msg.java
+++ b/core/src/ch/asynk/tankontank/game/hud/Msg.java
@@ -1,5 +1,6 @@
package ch.asynk.tankontank.game.hud;
+import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
@@ -22,6 +23,12 @@ public class Msg extends Bg
this.font = font;
}
+ public void write(String text, float duration)
+ {
+ TextBounds b = font.getBounds(text);
+ write(text, ((Gdx.graphics.getWidth() - b.width) / 2), ((Gdx.graphics.getHeight() - b.height) / 2), duration, 10);
+ }
+
public void write(String text, float x, float y, float duration, int padding)
{
this.text = text;