mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 22:14:34 +00:00
Make Escape exit threads test
This commit is contained in:
parent
99c65bb67c
commit
ef15735161
@ -52,6 +52,12 @@ static void error_callback(int error, const char* description)
|
|||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||||
|
{
|
||||||
|
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||||
|
glfwSetWindowShouldClose(window, GLFW_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
static int thread_main(void* data)
|
static int thread_main(void* data)
|
||||||
{
|
{
|
||||||
const Thread* thread = data;
|
const Thread* thread = data;
|
||||||
@ -101,6 +107,8 @@ int main(void)
|
|||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glfwSetKeyCallback(threads[i].window, key_callback);
|
||||||
|
|
||||||
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
|
glfwSetWindowPos(threads[i].window, 200 + 250 * i, 200);
|
||||||
glfwShowWindow(threads[i].window);
|
glfwShowWindow(threads[i].window);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user