diff --git a/core/src/sagittarius/model/FPS.java b/core/src/sagittarius/model/FPS.java new file mode 100644 index 0000000..f25b924 --- /dev/null +++ b/core/src/sagittarius/model/FPS.java @@ -0,0 +1,31 @@ +package sagittarius.model; + +import com.badlogic.gdx.Gdx; +import com.badlogic.gdx.graphics.g2d.Batch; +import com.badlogic.gdx.graphics.g2d.BitmapFont; +import com.badlogic.gdx.scenes.scene2d.Actor; + +import sagittarius.SagittariusGame; + +public class FPS extends Actor { + +// ---------- ATTRIBUTEs ---------- + + private BitmapFont font = new BitmapFont(); + private int frameRate; + +// ---------- METHODs ---------- + + @Override + public void act(float delta) { + super.act(delta); + frameRate = Gdx.graphics.getFramesPerSecond(); + } + + @Override + public void draw(Batch batch, float parentAlpha) { + super.draw(batch, parentAlpha); + font.draw(batch, frameRate + " fps", 3, SagittariusGame.getActiveScreen().getUIStage().getViewport().getWorldHeight() - 3); + } + +}