mirror of
https://github.com/glfw/glfw.git
synced 2026-02-17 21:12:34 +01:00
Added key input to quick tutorial.
This commit is contained in:
@@ -34,6 +34,12 @@ static void error_callback(int error, const char* description)
|
||||
fputs(description, stderr);
|
||||
}
|
||||
|
||||
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, GL_TRUE);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
GLFWwindow* window;
|
||||
@@ -52,6 +58,8 @@ int main(void)
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
|
||||
glfwSetKeyCallback(window, key_callback);
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
float ratio;
|
||||
|
||||
Reference in New Issue
Block a user