diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-30 22:04:38 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-30 22:04:38 +0200 |
commit | fbb91b22c5bcbc22a83aeda96e9992bf786c2f97 (patch) | |
tree | 4478d19a5b09b15dc2b465bd70c385c1f86471f9 /core/src/ch/asynk/tankontank/game | |
parent | 0b3f7e947212d7efc7690870b2ea06295c9b4ecd (diff) | |
download | RustAndDust-fbb91b22c5bcbc22a83aeda96e9992bf786c2f97.zip RustAndDust-fbb91b22c5bcbc22a83aeda96e9992bf786c2f97.tar.gz |
add game/Hud
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java new file mode 100644 index 0000000..8fa2b32 --- /dev/null +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -0,0 +1,33 @@ +package ch.asynk.tankontank.game; + +import com.badlogic.gdx.Gdx; + +import com.badlogic.gdx.scenes.scene2d.Stage; +import com.badlogic.gdx.scenes.scene2d.ui.Label; + +import com.badlogic.gdx.utils.viewport.Viewport; + +import ch.asynk.tankontank.TankOnTank; + +public class Hud extends Stage +{ + private final TankOnTank game; + private Label fps; + + public Hud(final TankOnTank game, Viewport viewport) + { + super(viewport); + this.game = game; + + fps = new Label("FPS: 0", game.skin); + fps.setPosition( 10, Gdx.graphics.getHeight() - 40); + addActor(fps); + } + + @Override + public void act(float delta) + { + super.act(delta); + fps.setText("FPS: " + Gdx.graphics.getFramesPerSecond()); + } +} |