When I use Gdx.app.exit()
the game window closes but the resources don’t appear to be released and the app is still running.
For instance, to exit on when the escape key is pressed:
public boolean keyDown(int keycode) {
//...
if (Gdx.input.isKeyPressed(Keys.ESCAPE))
Gdx.app.exit();
The window closes, the dispose()
method is called but Eclipse still reports that the app is open (because the terminate button is still available):
If the app had exited properly, the path to the JVM would have <terminated
> in front of it, and the red terminate button would be greyed out.
Also when I use hide()
and then dispose()
:
@Override
public void hide() {
dispose();
}
@Override
public void dispose() {
map.dispose();
...
playerHitbox.dispose();
System.out.println("----- END OF OUTPUT -----");
}
The same thing happens. You have to terminate the app with the button provided by Eclipse, or in the release version use the kill
command (or task manager).
So my question is, how can I properly exit the app so all resources are gracefully unloaded, the window hides and the process exits in LibGDX?