diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 19:38:36 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-16 19:38:36 +0200 |
commit | d3a8eb97addddafca2973c772b1ca0872c4fc79b (patch) | |
tree | 27d3cdd046e3cd96e29a3fe5d245c7ee009f7046 /core/src | |
parent | ffe8711b448a5c10ce3e86e5013e7e0a6de2faf0 (diff) | |
download | RustAndDust-d3a8eb97addddafca2973c772b1ca0872c4fc79b.zip RustAndDust-d3a8eb97addddafca2973c772b1ca0872c4fc79b.tar.gz |
Msg: add write(String, float)
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/hud/Msg.java | 7 |
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; |