1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 10:48:51 -05:00

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 keyrepeat = 0;
static GLboolean systemkeys = 1; static GLboolean systemkeys = 1;
static GLboolean closeable = 1;
static unsigned int counter = 0; static unsigned int counter = 0;
static const char* get_key_name(int key) 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) static int window_close_callback(GLFWwindow window)
{ {
printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime()); printf("%08x at %0.3f: Window close\n", counter++, glfwGetTime());
return 1; return closeable;
} }
static void window_refresh_callback(GLFWwindow window) 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"); printf("(( system keys %s ))\n", systemkeys ? "enabled" : "disabled");
break; break;
} }
case GLFW_KEY_C:
{
closeable = !closeable;
printf("(( closing %s ))\n", closeable ? "enabled" : "disabled");
break;
}
} }
} }