|
@@ -132,9 +132,19 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
final String message = GLFWErrorCallback.getDescription(description);
|
|
final String message = GLFWErrorCallback.getDescription(description);
|
|
listener.handleError(message, new Exception(message));
|
|
listener.handleError(message, new Exception(message));
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void close(){
|
|
|
|
+ super.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void callback(long args) {
|
|
|
|
+ super.callback(args);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
- if (glfwInit() != GLFW_TRUE) {
|
|
|
|
|
|
+ if (!glfwInit()) {
|
|
throw new IllegalStateException("Unable to initialize GLFW");
|
|
throw new IllegalStateException("Unable to initialize GLFW");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -161,7 +171,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
|
glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
|
|
glfwWindowHint(GLFW_RESIZABLE, settings.isResizable() ? GLFW_TRUE : GLFW_FALSE);
|
|
glfwWindowHint(GLFW_RESIZABLE, settings.isResizable() ? GLFW_TRUE : GLFW_FALSE);
|
|
|
|
|
|
- glfwWindowHint(GLFW_DOUBLE_BUFFER, GLFW_TRUE);
|
|
|
|
|
|
+ //glfwWindowHint(GLFW_DOUBLE_BUFFER, GLFW_TRUE);
|
|
glfwWindowHint(GLFW_DEPTH_BITS, settings.getDepthBits());
|
|
glfwWindowHint(GLFW_DEPTH_BITS, settings.getDepthBits());
|
|
glfwWindowHint(GLFW_STENCIL_BITS, settings.getStencilBits());
|
|
glfwWindowHint(GLFW_STENCIL_BITS, settings.getStencilBits());
|
|
glfwWindowHint(GLFW_SAMPLES, settings.getSamples());
|
|
glfwWindowHint(GLFW_SAMPLES, settings.getSamples());
|
|
@@ -206,12 +216,21 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
settings.setResolution(width, height);
|
|
settings.setResolution(width, height);
|
|
listener.reshape(width, height);
|
|
listener.reshape(width, height);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void close() {
|
|
|
|
+ super.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void callback(long args) {
|
|
|
|
+ super.callback(args);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
glfwSetWindowFocusCallback(window, windowFocusCallback = new GLFWWindowFocusCallback() {
|
|
glfwSetWindowFocusCallback(window, windowFocusCallback = new GLFWWindowFocusCallback() {
|
|
@Override
|
|
@Override
|
|
- public void invoke(final long window, final int focused) {
|
|
|
|
- final boolean focus = (focused == GL_TRUE);
|
|
|
|
|
|
+ public void invoke(final long window, final boolean focus) {
|
|
if (wasActive != focus) {
|
|
if (wasActive != focus) {
|
|
if (!wasActive) {
|
|
if (!wasActive) {
|
|
listener.gainFocus();
|
|
listener.gainFocus();
|
|
@@ -223,6 +242,16 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
wasActive = !wasActive;
|
|
wasActive = !wasActive;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void close() {
|
|
|
|
+ super.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void callback(long args) {
|
|
|
|
+ super.callback(args);
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
// Center the window
|
|
// Center the window
|
|
@@ -260,17 +289,17 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
}
|
|
}
|
|
|
|
|
|
if (errorCallback != null) {
|
|
if (errorCallback != null) {
|
|
- errorCallback.release();
|
|
|
|
|
|
+ errorCallback.close();
|
|
errorCallback = null;
|
|
errorCallback = null;
|
|
}
|
|
}
|
|
|
|
|
|
if (windowSizeCallback != null) {
|
|
if (windowSizeCallback != null) {
|
|
- windowSizeCallback.release();
|
|
|
|
|
|
+ windowSizeCallback.close();
|
|
windowSizeCallback = null;
|
|
windowSizeCallback = null;
|
|
}
|
|
}
|
|
|
|
|
|
if (windowFocusCallback != null) {
|
|
if (windowFocusCallback != null) {
|
|
- windowFocusCallback.release();
|
|
|
|
|
|
+ windowFocusCallback.close();
|
|
windowFocusCallback = null;
|
|
windowFocusCallback = null;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -460,7 +489,7 @@ public abstract class LwjglWindow extends LwjglContext implements Runnable {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
- if (glfwWindowShouldClose(window) == GL_TRUE) {
|
|
|
|
|
|
+ if (glfwWindowShouldClose(window)) {
|
|
listener.requestClose(false);
|
|
listener.requestClose(false);
|
|
}
|
|
}
|
|
}
|
|
}
|