summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-16 19:38:36 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-16 19:38:36 +0200
commitd3a8eb97addddafca2973c772b1ca0872c4fc79b (patch)
tree27d3cdd046e3cd96e29a3fe5d245c7ee009f7046 /core
parentffe8711b448a5c10ce3e86e5013e7e0a6de2faf0 (diff)
downloadRustAndDust-d3a8eb97addddafca2973c772b1ca0872c4fc79b.zip
RustAndDust-d3a8eb97addddafca2973c772b1ca0872c4fc79b.tar.gz
Msg: add write(String, float)
Diffstat (limited to 'core')
-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;