BaseSimpleGame.quit() calls System.exit()?

May be this is a stupid question  :roll:



I make some configs, map loading etc. in a Swing JFrame, and from there I start my SimpleGame. Now I looked for a nice method for closing my SimpleGame, and the only which sounds good was quit(). However, when I looked in the implementation in BaseSimpleGame, I found this:



    protected void quit() {
        super.quit();
        System.exit( 0 );
    }



Of course, this also kills my JFrame. So, long story short: How can I end my SimpleGame with sources released and everything, but let my JFrame alive?
If nothing helps, I could call SimpleGame from another VM, e.g. with System.execute, but I can't imagine that there is no other way to end SimpleGame properly...

Use StandardGame instead? :wink:



You'll likely just have to write your own replacement for it…that's what I did before StandardGame.

Yeah, this is on my list. The JFrame is just a quick-and-dirty solution, of course I want to have in-game menus later, and of course the best way for these things are GameStates and StandardGame. However, I want to release something, so if you still have one of your SimpleGame ending code snippets, I would be glad…



If not, I can still use System.execute, which would be OK as a temporary solution…

You can also just override the quit() method in your SimpleGame to not call exit…

I’m sorry to unburry this subject, but i’m facing the same kind of problem, and googling around didn’t helped me.



My case is simple, I’ve got a main java application (a simple swing application), within that application I can launch a 3D viewer i’ve made with JME.



So my 3D viewer is SimplePassGame extended, where I redefined the quit() method like this :



[java]protected void quit() {

if (display != null)

display.close();



//System.exit(-1); // Cannot do that because it will also kill my main application :frowning:

//so there the thread AWTEventQueue. still waiting there or something ?!

}[/java]



So when i press escape, the 3D view dissapear, and the main application still alive.



The problem is that it’s seems something is not closed correctly and still running.



Causing problems in my main application (display problem, blinking, …), also I cannot restart the 3D view again…



Is anybody there could really help me, it’s been days I’m on it without results.



PS : I Cannot launch it as external process, the 3D viewer need to know some data coming from the main application in realtime.