SimpleApplication has now built in methods to display or not fps tex and stat view.
git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7008 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
6e76c602e4
commit
d9f39f6b0b
@ -73,6 +73,7 @@ public abstract class SimpleApplication extends Application {
|
||||
protected StatsView statsView;
|
||||
protected FlyByCamera flyCam;
|
||||
protected boolean showSettings = true;
|
||||
private boolean showFps = true;
|
||||
private AppActionListener actionListener = new AppActionListener();
|
||||
|
||||
private class AppActionListener implements ActionListener {
|
||||
@ -227,11 +228,13 @@ public abstract class SimpleApplication extends Application {
|
||||
|
||||
float tpf = timer.getTimePerFrame() * speed;
|
||||
|
||||
secondCounter += timer.getTimePerFrame();
|
||||
int fps = (int) timer.getFrameRate();
|
||||
if (secondCounter >= 1.0f) {
|
||||
fpsText.setText("Frames per second: " + fps);
|
||||
secondCounter = 0.0f;
|
||||
if (showFps) {
|
||||
secondCounter += timer.getTimePerFrame();
|
||||
int fps = (int) timer.getFrameRate();
|
||||
if (secondCounter >= 1.0f) {
|
||||
fpsText.setText("Frames per second: " + fps);
|
||||
secondCounter = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// update states
|
||||
@ -251,6 +254,17 @@ public abstract class SimpleApplication extends Application {
|
||||
stateManager.postRender();
|
||||
}
|
||||
|
||||
public void setDisplayFps(boolean show) {
|
||||
showFps = show;
|
||||
fpsText.setCullHint(show ? CullHint.Never : CullHint.Always);
|
||||
|
||||
}
|
||||
|
||||
public void setDisplayStatView(boolean show) {
|
||||
statsView.setEnabled(show);
|
||||
statsView.setCullHint(show ? CullHint.Never : CullHint.Always);
|
||||
}
|
||||
|
||||
public abstract void simpleInitApp();
|
||||
|
||||
public void simpleUpdate(float tpf) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user