• Advertisement
Sign in to follow this  

getMousePos in GLFW

This topic is 4792 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, I'm having a bit of problem in my programming. I'd like to get the mouseposition after clicking, so I use the function glfwgetMousePos (int *xpos, int *ypos) in GLFW. Also, i assign xpos = 0 in the beginning, and this is the answer i get wherever i click. How am i supposed to use this function correctly, so that xpos and ypos gets the current location? All help appreciated!

Share this post


Link to post
Share on other sites
Advertisement

static GLuint x_pos(0), y_pos(0) ;

glfwGetMousePos( &x_pos, &y_pos ) ;
// variable 'x_pos' and 'y_pos' should hold the last known coordinates
// for the mouse position. There is another function in GLFW
// that determines whether or not a button has been clicked.
// Use that in conjunction from the above example to get
// the last mouse clicking position.



~Khaosifix

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement