|
|
@ -73,6 +73,7 @@ public abstract class SimpleApplication extends Application { |
|
|
|
protected Node rootNode = new Node("Root Node"); |
|
|
|
protected Node rootNode = new Node("Root Node"); |
|
|
|
protected Node guiNode = new Node("Gui Node"); |
|
|
|
protected Node guiNode = new Node("Gui Node"); |
|
|
|
protected float secondCounter = 0.0f; |
|
|
|
protected float secondCounter = 0.0f; |
|
|
|
|
|
|
|
protected int frameCounter = 0; |
|
|
|
protected BitmapText fpsText; |
|
|
|
protected BitmapText fpsText; |
|
|
|
protected BitmapFont guiFont; |
|
|
|
protected BitmapFont guiFont; |
|
|
|
protected StatsView statsView; |
|
|
|
protected StatsView statsView; |
|
|
@ -241,10 +242,12 @@ public abstract class SimpleApplication extends Application { |
|
|
|
|
|
|
|
|
|
|
|
if (showFps) { |
|
|
|
if (showFps) { |
|
|
|
secondCounter += timer.getTimePerFrame(); |
|
|
|
secondCounter += timer.getTimePerFrame(); |
|
|
|
int fps = (int) timer.getFrameRate(); |
|
|
|
frameCounter ++; |
|
|
|
if (secondCounter >= 1.0f) { |
|
|
|
if (secondCounter >= 1.0f) { |
|
|
|
|
|
|
|
int fps = (int) (frameCounter / secondCounter); |
|
|
|
fpsText.setText("Frames per second: " + fps); |
|
|
|
fpsText.setText("Frames per second: " + fps); |
|
|
|
secondCounter = 0.0f; |
|
|
|
secondCounter = 0.0f; |
|
|
|
|
|
|
|
frameCounter = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|