mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Added abort via escape key.
This commit is contained in:
parent
e55b5fc27c
commit
eeed6394c0
@ -74,6 +74,15 @@ static int window_close_callback(GLFWwindow dummy)
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow dummy, int key, int action)
|
||||
{
|
||||
if (key == GLFW_KEY_ESCAPE)
|
||||
{
|
||||
glfwCloseWindow(window);
|
||||
window = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void list_modes(GLFWvidmode* modes, int count)
|
||||
{
|
||||
int i;
|
||||
@ -100,6 +109,7 @@ static void test_modes(GLFWvidmode* modes, int count)
|
||||
|
||||
glfwSetWindowSizeCallback(window_size_callback);
|
||||
glfwSetWindowCloseCallback(window_close_callback);
|
||||
glfwSetKeyCallback(key_callback);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user