mirror of
https://github.com/glfw/glfw.git
synced 2026-09-22 08:50:15 +00:00
Replaced automatic closing with window parameter.
This commit is contained in:
+4
-10
@@ -32,14 +32,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static GLboolean running = GL_TRUE;
|
||||
|
||||
static int window_close_callback(GLFWwindow window)
|
||||
{
|
||||
running = GL_FALSE;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static const char* titles[] =
|
||||
{
|
||||
"Foo",
|
||||
@@ -51,6 +43,7 @@ static const char* titles[] =
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
GLboolean running = GL_TRUE;
|
||||
GLFWwindow windows[4];
|
||||
|
||||
if (!glfwInit())
|
||||
@@ -60,8 +53,6 @@ int main(void)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwSetWindowCloseCallback(window_close_callback);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
windows[i] = glfwCreateWindow(200, 200, GLFW_WINDOWED, titles[i], NULL);
|
||||
@@ -88,6 +79,9 @@ int main(void)
|
||||
glfwMakeContextCurrent(windows[i]);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glfwSwapBuffers(windows[i]);
|
||||
|
||||
if (glfwGetWindowParam(windows[i], GLFW_CLOSE_REQUESTED))
|
||||
running = GL_FALSE;
|
||||
}
|
||||
|
||||
glfwPollEvents();
|
||||
|
||||
Reference in New Issue
Block a user