projet-programmation-orient.../core/src/sagittarius/model/FPS.java

31 lines
583 B
Java
Raw Normal View History

2021-04-09 12:53:55 +00:00
package sagittarius.model;
import com.badlogic.gdx.Gdx;
2021-04-13 19:08:25 +00:00
import com.badlogic.gdx.scenes.scene2d.Stage;
2021-04-09 12:53:55 +00:00
2021-04-13 19:08:25 +00:00
public class FPS extends BaseActor {
2021-04-09 12:53:55 +00:00
// ---------- ATTRIBUTEs ----------
private int frameRate;
// ---------- METHODs ----------
2021-04-13 19:08:25 +00:00
public FPS(Stage stage) {
super();
setPosition(3, stage.getViewport().getWorldHeight() - 3);
}
2021-04-09 12:53:55 +00:00
@Override
2021-04-22 15:43:41 +00:00
public void act(float dt) {
super.act(dt);
2021-04-09 12:53:55 +00:00
frameRate = Gdx.graphics.getFramesPerSecond();
}
@Override
2021-04-13 19:08:25 +00:00
protected String getInfo() {
return frameRate + " fps";
2021-04-09 12:53:55 +00:00
}
}