Hey.
I am working on a 3D game, which uses LWJGL3. Game window is made with GLFW and I need to switch the cursor modes from hidden/disabled to normal and vice-versa. Originally I was using hidden mode for GLFW cursor, but now I need the disabled one. Normal cursor mode is used for menu etc. and the hidden/disabled for in-game movement. I switch the mode with the function below.
public static void setGrabbed(boolean b)
{
if(b) GLFW.glfwSetInputMode(window, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_DISABLED);
else GLFW.glfwSetInputMode(window, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_NORMAL);
if(GLFW.glfwGetInputMode(window, GLFW.GLFW_CURSOR) == GLFW.GLFW_CURSOR_NORMAL) System.out.println("normal");
isGrabbed = b;
}
As I said, now I need the disabled not the hidden mode, but after the change the cursor behaves strangely. When the cursor is disabled I can freely look around, then I pause the game and menu shows up. However, despite the cursor was set to normal I can’t move it. It is visible, but it jumps to the window center all the time I move my mouse. The problem occures only with disabled not hidden mode. Also the function prints the message so the mode must be switching. I tested it on LWJGL 3.1.0 and 3.1.5 without any result.
Do you have any suggestions? It’s my first poste, I hope I explained the case clearly and sory for bad English