glfwGetMouseButton (and GetKey) issue

nobody wrote on Wednesday, July 16, 2008:

Please forgive this newbie question.

In my main program loop, immediately after swapping the buffers, I’m checking to see if the left mouse button has been pressed using glfwGetMouseButton. It seems like disabling GLFW_KEY_REPEAT has no effect because I can hold the mouse button down and it reports its state as GLFW_PRESS continuously through each iteration of the loop until I release the button. I’ve read on this board that GLFW_KEY_REPEAT only applies when you use a callback function but, as far as I can tell, a callback function isn’t appropriate for what I’m doing. Is there any way I can get around this problem using glfwGetMouseButton so that as soon as the state is polled, it switches to GLFW_RELEASE until the button is explicitly pressed again?


nobody wrote on Thursday, July 17, 2008:

Nevermind! I found a roundabout way to do it: I changed the condition to one based on an integer that can be in three states. Set it to 0 when the button is released, set it to 1 when the button is clicked, and set it to 2 if the button is clicked and the integer’s current value is 1.