And you can see that it’s not showing up here, if I press F5 it’s not showing up here.
After various trials, I found that if I remove the extra content in super, the parameters will be displayed.
We would have to see all of the code in those classes to really know what is causing the issue
It also looks strange how you are initiating things, but again I am not entirely sure since I am just seeing a small code snippet. But if you are working in the Main class that extends SimpleApplication, then usually you want to initiate things in the simpleInitApp() method after the jme context has been started.
But if I had to take my best guess about what is causing the issue, I would tell you to check your code to make sure you are not modifying any static ColorRGBA constants, such as ColorRGBA.White since that is the color used by default for the text in the stats view that appears to be missing.
package com.mygame;
import com.jme3.app.SimpleApplication;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.renderer.RenderManager;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Box;
/**
* This is the Main Class of your Game. You should only do initialization here.
* Move your Logic into AppStates or Controls
* @author normenhansen
*/
public class Main extends SimpleApplication {
public Main(){
super(
new Test()
);
}
public static void main(String[] args) {
Main app = new Main();
app.start();
}
@Override
public void simpleInitApp() {
// Box b = new Box(1, 1, 1);
// Geometry geom = new Geometry("Box", b);
//
// Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
// mat.setColor("Color", ColorRGBA.Blue);
// geom.setMaterial(mat);
//
// rootNode.attachChild(geom);
}
@Override
public void simpleUpdate(float tpf) {
//TODO: add update code
}
@Override
public void simpleRender(RenderManager rm) {
//TODO: add render code
}
}
public class Test extends BaseAppState{
private InputManager inputManager;
private AssetManager assetManager;
private SimpleApplication simpleApp;
@Override
protected void initialize(Application aplctn) {
simpleApp = (SimpleApplication) aplctn;
assetManager = aplctn.getAssetManager();
inputManager = aplctn.getInputManager();
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(aplctn.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
simpleApp.getRootNode().attachChild(geom);
}
@Override
protected void cleanup(Application aplctn) {
}
@Override
protected void onEnable() {
}
@Override
protected void onDisable() {
}
}
public class Test extends BaseAppState{
private InputManager inputManager;
private AssetManager assetManager;
private SimpleApplication simpleApp;
@Override
protected void initialize(Application aplctn) {
simpleApp = (SimpleApplication) aplctn;
assetManager = aplctn.getAssetManager();
inputManager = aplctn.getInputManager();
Box b = new Box(1, 1, 1);
Geometry geom = new Geometry("Box", b);
Material mat = new Material(aplctn.getAssetManager(), "Common/MatDefs/Misc/Unshaded.j3md");
mat.setColor("Color", ColorRGBA.Blue);
geom.setMaterial(mat);
simpleApp.getRootNode().attachChild(geom);
}
@Override
protected void cleanup(Application aplctn) {
}
@Override
protected void onEnable() {
}
@Override
protected void onDisable() {
}
}
This is a simple example
When you delete new Test() you will notice that FPS parameters are displayed but when you add new Test() you will notice that those parameters are gone
This code is being run before app.start() and that can cause all sorts of strange problems if you try doing jme related things before the jme context is initiated.
You should add the code for new Test() to the simpleInitApp() method and that will probably fix everything. You should almost never be doing something JME related prior to the jme context being initiated (which happens when app.start() is called) otherwise you will run into all sorts of weird bugs, if the app even manages to run at all.
Edit: I overlooked the fact that the SimpleApplication class does have an initialStates paramater in its constructor and your Test class is an AppState, so it sounds like it should be handling things in the correct order if its all set up correctly… However I never did it this way so its still worth trying to move your initation to the simpleInitApp() method and see if that fixes anything.
Notice that when using the first constructor (no-arg constructor) it will add the StatsAppState and a bunch of other states by default for you. If you are using the second constructor you should add them yourself.
Yes, the whole point of the second constructor is that you can carefully select of what of JME standard app states you want to include, include your own startup app states, and order them however you want.
Consequently, if you want to use it then you need to specify the JME things that you want to keep.
I highly recommend that constructor in the long run because it allows you to get rid of some of the ugly code (like FlyCam stuff) that JME includes by default.