Added window close control.

This commit is contained in:
Camilla Berglund 2012-02-07 16:40:26 +01:00
parent 0b34cb1466
commit 5159cfc2b0

View File

@ -42,6 +42,7 @@
static GLboolean keyrepeat = 0;
static GLboolean systemkeys = 1;
static GLboolean closeable = 1;
static unsigned int counter = 0;
static const char* get_key_name(int key)
@ -230,7 +231,7 @@ static void window_size_callback(GLFWwindow window, int width, int height)
static int window_close_callback(GLFWwindow window)
{
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
return 1;
return closeable;
}
static void window_refresh_callback(GLFWwindow window)
@ -312,6 +313,14 @@ static void key_callback(GLFWwindow window, int key, int action)
printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled");
break;
}
case GLFW_KEY_C:
{
closeable = !closeable;
printf("(( closing %s ))\n", closeable ? "enabled" : "disabled");
break;
}
}
}