Quick Q on StandardGame and MenuState

Hokay. so.

1)I take TestStandardGame in the jmetest.game package.



2) I turn:

DebugGameState state = new DebugGameState();

into

MenuState state = new MenuState("State");



3) A black screen comes up. Nothing works, not even escape. I never find out why.



Why?



Is it safe to say that there is one and only one simple conclusion: Absolute Mouses do not work? No matter what I do it keeps freezing at a black screen.

DebugGameState contains the functionality to quit when the escape key is pressed. Removing or replacing that game state results in removing this way of terminating the program.

Gaheris is correct.  To get the desired result I expect you'll want to leave the DebugGameState and ADD MenuState instead of replace.

Hmm… now I get this message


Exception in thread "main" java.lang.NullPointerException
at org.lwjgl.opengl.GL11.glMatrixMode(GL11.java:1737)
at com.jme.renderer.lwjgl.LWJGLCamera.onFrustumChange(LWJGLCamera.java:115)
at com.jme.renderer.AbstractCamera.<init>(AbstractCamera.java:252)
at com.jme.renderer.lwjgl.LWJGLCamera.<init>(LWJGLCamera.java:69)
at com.jme.renderer.lwjgl.LWJGLRenderer.createCamera(LWJGLRenderer.java:236)
at com.jmex.game.state.CameraGameState.initCamera(CameraGameState.java:111)
at com.jmex.game.state.CameraGameState.<init>(CameraGameState.java:76)
at jmetest.game.state.MenuState.<init>(MenuState.java:67)
at notrium.Notrium.main(Notrium.java:24)



From this code

public static void main(String[] args) throws Exception {
// Instantiate StandardGame
StandardGame game = new StandardGame("A Simple Test");
// Show settings screen
GameSettingsPanel.prompt(game.getSettings());
// Start StandardGame, it will block until it has initialized successfully, then return
game.start();

// Create a DebugGameState - has all the built-in features that SimpleGame provides
// NOTE: for a distributable game implementation you'll want to use something like
// BasicGameState instead and provide control features yourself.
DebugGameState state = new DebugGameState();
MenuState secstate = new MenuState("astate");

System.out.println("Hi!");

// Add it to the manager
GameStateManager.getInstance().attachChild(state);
GameStateManager.getInstance().attachChild(secstate);
// Activate the game state
state.setActive(true);
secstate.setActive(false);
}


ADD: Hmm.. I think I might have traced the problem!
initCamera() in CameraGameState doesn't do this:

    RenderThreadExecutable exe = new RenderThreadExecutable() {
    DisplaySystem display = DisplaySystem.getDisplaySystem();
            public void doAction() {
        cam = display.getRenderer().createCamera(
        display.getWidth(),
        display.getHeight());
       
        cam.setFrustumPerspective(45.0f,
        (float) display.getWidth() /
        (float) display.getHeight(), 1, 1000);
       
        cam.update();
            }
        };
        RenderThreadActionQueue.addToQueue(exe);

You may need to throw that instantiation into GameTaskQueue.  It looks like it's an issue with trying to make camera changes outside of the OpenGL thread.