Added FPS Meter.

This commit is contained in:
Jeasonfire 2015-05-13 22:35:46 +03:00
parent d3092a17ec
commit ed9d530705
2 changed files with 3 additions and 3 deletions

View File

@ -207,7 +207,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
guiManager.getRootNode().addChild(button); guiManager.getRootNode().addChild(button);
TextNode text = new TextNode("test-text", "Test!"); TextNode text = new TextNode("test-text", "Test!");
text.setPosition(0.01f, 0.99f); text.setPosition(0.8f, 0.5f);
guiManager.getRootNode().addChild(text); guiManager.getRootNode().addChild(text);
} }

View File

@ -89,6 +89,8 @@ public class RenderingSystem extends EntitySystem {
renderEntities(deltaTime); renderEntities(deltaTime);
renderGUI(new Vector2(0, 0)); renderGUI(new Vector2(0, 0));
renderDebug(camera); renderDebug(camera);
drawString("FPS: " + Gdx.graphics.getFramesPerSecond(), new Vector2(camera.position.x - 12, camera.position.y + 8));
renderFont(fontCamera); renderFont(fontCamera);
} }
@ -132,8 +134,6 @@ public class RenderingSystem extends EntitySystem {
s.draw(batch); s.draw(batch);
} }
if (node instanceof TextNode) { if (node instanceof TextNode) {
Log.info("X: " + position.x);
Log.info("Y: " + position.y);
drawString(((TextProperty) node).getText(), new Vector2(position.x * AppUtil.VPHEIGHT_CONST * aspectratio + camera.position.x, drawString(((TextProperty) node).getText(), new Vector2(position.x * AppUtil.VPHEIGHT_CONST * aspectratio + camera.position.x,
position.y * AppUtil.VPHEIGHT_CONST + camera.position.y)); position.y * AppUtil.VPHEIGHT_CONST + camera.position.y));
} }