Title says it all.
LWJGL has a method that you can periodically query to check if the application is attempting to close (by the close button, ALT-F4, etc)
[java]Display.isCloseRequested()[/java]
Maybe it’s me, but using this in the update loop doesn’t seem to trigger when hitting ALT-F4.
[java]
@Override
public void simpleUpdate(float tpf) {
if (Display.isCloseRequested()) {
// Query user to save before quitting. For now, just save.
System.out.println(“Saving before quitting.”);
}
[…]
[/java]
maybe it happens so fast that System.out.println(); doesnt display ?
I traced it with a breakpoint. It didn’t trigger. Besides, even if it were going too fast, the printout would still happen, just lagged.
Anyway, can anyone reproduce it? As I said, maybe it’s me.
thats what happens when you hear sbook, this is jme3 not lwjgl, it is not supposed to work.
[java]
@Override
public void destroy()
{
super.destroy();
System.out.println(“Exiting Game”);
}
[/java]
Now it works just override simple application’s destroy.
Thanks. Works like a charm.
It works but anyone wanting to use that; be warned. If the game/app crashes, this will be invoked.