blob: 8fa2b32d293c9ab13176f8a94304809cdc24bb05 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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());
}
}
|