close window on game end
This commit is contained in:
@@ -431,6 +431,7 @@ public class DDDView extends GameAdapter implements CommandSender {
|
|||||||
@Override
|
@Override
|
||||||
public void onGameEnd() {
|
public void onGameEnd() {
|
||||||
openPopup("End");
|
openPopup("End");
|
||||||
|
this.window.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -64,6 +64,8 @@ public class Window implements Closeable {
|
|||||||
private ImInt detailLevel = new ImInt(10);
|
private ImInt detailLevel = new ImInt(10);
|
||||||
private ImBoolean pixelatedFrame = new ImBoolean(true);
|
private ImBoolean pixelatedFrame = new ImBoolean(true);
|
||||||
|
|
||||||
|
private boolean shouldBeClosed = false;
|
||||||
|
|
||||||
public Window(Renderer renderer, World world, Camera camera) {
|
public Window(Renderer renderer, World world, Camera camera) {
|
||||||
this.renderer = new Renderer();
|
this.renderer = new Renderer();
|
||||||
this.cam = camera;
|
this.cam = camera;
|
||||||
@@ -280,7 +282,7 @@ public class Window implements Closeable {
|
|||||||
|
|
||||||
// Run the rendering loop until the user has attempted to close
|
// Run the rendering loop until the user has attempted to close
|
||||||
// the window or has pressed the ESCAPE key.
|
// the window or has pressed the ESCAPE key.
|
||||||
while (!glfwWindowShouldClose(window)) {
|
while (!shouldBeClosed && !glfwWindowShouldClose(window)) {
|
||||||
|
|
||||||
newFrame();
|
newFrame();
|
||||||
|
|
||||||
@@ -304,8 +306,13 @@ public class Window implements Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop() {
|
||||||
|
shouldBeClosed = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
|
shouldBeClosed = true;
|
||||||
this.renderer.close();
|
this.renderer.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user