diff options
author | Éloi Rivard <azmeuk@gmail.com> | 2013-03-27 14:29:57 +0100 |
---|---|---|
committer | Éloi Rivard <azmeuk@gmail.com> | 2013-04-04 11:17:37 +0200 |
commit | 5463f56704edbbb20fa5cfe793cd4eef175c6d10 (patch) | |
tree | 9daeab6aeecb140078ab6c4d810d51a01dbc2dea | |
parent | c670dde7c62d1e0c2e69ca0720b1b11a3464beba (diff) |
* Fixed mouse position.
-rw-r--r-- | tests/glfw/glfwsample.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/glfw/glfwsample.c b/tests/glfw/glfwsample.c index 3d9be100..79b504b6 100644 --- a/tests/glfw/glfwsample.c +++ b/tests/glfw/glfwsample.c @@ -67,8 +67,8 @@ void Init() glfwSetWindowSizeCallback(OnResize); glfwSetWindowRefreshCallback(OnRefresh); glfwSetMouseWheelCallback(OnMouseWheel); - //glfwSetMousePosCallback(OnMouseMove); - //glfwSetMouseButtonCallback(OnMouseClick); + glfwSetMousePosCallback(OnMouseMove); + glfwSetMouseButtonCallback(OnMouseClick); // set the projection matrix to a normal frustum with a max depth of 50 glMatrixMode(GL_PROJECTION); @@ -323,7 +323,12 @@ void OnMouseClick( int button, int action ){ } void OnMouseMove( int x, int y ){ - printf("Mouse has been moved to %i %i\n", x, y); + int lState = glfwGetMouseButton(GLFW_MOUSE_BUTTON_LEFT); + + if (lState == GLFW_PRESS) + printf("Dragged %i to %i %i\n", GLFW_MOUSE_BUTTON_LEFT, x, y); + if(lState == GLFW_RELEASE) + printf("Moved %i to %i %i\n", GLFW_MOUSE_BUTTON_LEFT, x, y); } void OnMouseWheel( int pos ){ |