Move glfwDragWindow demo to windows test

This commit is contained in:
Camilla Löwy 2017-08-04 02:35:13 +02:00
parent a4c76fbeed
commit ce87a1142e
2 changed files with 7 additions and 7 deletions

View File

@ -68,12 +68,6 @@ static void error_callback(int error, const char* description)
fprintf(stderr, "Error: %s\n", description); fprintf(stderr, "Error: %s\n", description);
} }
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
glfwDragWindow(window);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{ {
if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
@ -102,7 +96,6 @@ int main(void)
} }
glfwSetKeyCallback(window, key_callback); glfwSetKeyCallback(window, key_callback);
glfwSetMouseButtonCallback(window, mouse_button_callback);
glfwMakeContextCurrent(window); glfwMakeContextCurrent(window);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);

View File

@ -88,6 +88,12 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
} }
} }
void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
{
if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS)
glfwDragWindow(window);
}
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
int i, ch; int i, ch;
@ -131,6 +137,7 @@ int main(int argc, char** argv)
} }
glfwSetKeyCallback(windows[i], key_callback); glfwSetKeyCallback(windows[i], key_callback);
glfwSetMouseButtonCallback(windows[i], mouse_button_callback);
glfwMakeContextCurrent(windows[i]); glfwMakeContextCurrent(windows[i]);
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress); gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);