mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Move glfwDragWindow demo to windows test
This commit is contained in:
parent
a4c76fbeed
commit
ce87a1142e
@ -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);
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user