I’m trying to make camera movement when pressing the right mouse button down and moving the mouse. When the button is down, I want the cursor to be hidden:
if( InputHandler.isButtonDown( InputHandler.MOUSE_RIGHT ) ) {
GLFW.glfwSetInputMode( ExampleGame.display.getWindowID( ),GLFW.GLFW_CURSOR,GLFW.GLFW_CURSOR_HIDDEN );
// move camera (working but I left it out)
} else {
GLFW.glfwSetInputMode( ExampleGame.display.getWindowID( ),GLFW.GLFW_CURSOR,GLFW.GLFW_CURSOR_NORMAL );
}
But it only works when I let the second glfwSetInputMode in the else statement out and that means that the mouse stays hidden!
What happens with the above code, is that the mouse hides for about a frame when pressing the right mouse button and the reappears because the else statement gets activated. But why does the hide cursor only work when I let the mouse button go? Everything else works directly when pressing it…