added some debug information in options page

This commit is contained in:
Harrison Deng 2017-11-24 17:32:28 -06:00
parent f591a8e60e
commit 4c86b17807

View File

@ -156,6 +156,34 @@ public class OptionsPage extends Page {
return super.keyUp(event, keycode);
}
});
optionsTable.row();
Label fpsLabel = new Label("", core.getDefaultSkin()) {
@Override
public void act(float delta) {
setText("Current Frames Per Second: " + Gdx.graphics.getFramesPerSecond());
super.act(delta);
}
};
optionsTable.add(fpsLabel).colspan(2);
optionsTable.row();
Label usageLabel = new Label("Current usage (lower the better): " + 100f*((float)(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/(float)Runtime.getRuntime().totalMemory()) + "%", core.getDefaultSkin()) {
float refreshTime = 60;
@Override
public void act(float delta) {
refreshTime -= delta;
if (refreshTime <= 0) {
refreshTime = 60;
setText("Current usage (lower the better): " + 100f*((float)(Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory())/(float)Runtime.getRuntime().totalMemory()) + "%");
}
super.act(delta);
}
};
optionsTable.add(usageLabel).colspan(2);
}
public void saveOptions(Preferences prefs) {