Advertisement
Guest User

Untitled

a guest
May 5th, 2015
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.58 KB | None | 0 0
  1. void mouse_button_callback(GLFWwindow* window, int button, int action, int mods)
  2. {
  3.     if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_PRESS){
  4.  
  5.        double xpos, ypos;
  6.        glfwGetCursorPos(window, &xpos, &ypos);
  7.        mouseSpeed.p[0] = xpos;
  8.        mouseSpeed.p[2] = ypos;
  9.  
  10.     }
  11.  
  12.     if (button == GLFW_MOUSE_BUTTON_LEFT && action == GLFW_RELEASE){
  13.  
  14.        double xpos, ypos;
  15.        glfwGetCursorPos(window, &xpos, &ypos);
  16.        mouseSpeed.p[0] = (xpos - mouseSpeed.p[0])  * .001;
  17.        mouseSpeed.p[2] = (ypos -mouseSpeed.p[2])  * .001;
  18.  
  19.        SphereSpeed = mouseSpeed;
  20.  
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement