Skip to content

Commit

Permalink
Put GLFW in relative mouse mode when the cursor is disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffM2501 committed Mar 17, 2024
1 parent 9a8d73e commit 887b943
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/platforms/rcore_desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -972,6 +972,9 @@ void EnableCursor(void)
// Set cursor position in the middle
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);

if (glfwRawMouseMotionSupported())
glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);

CORE.Input.Mouse.cursorHidden = false;
}

Expand All @@ -983,6 +986,9 @@ void DisableCursor(void)
// Set cursor position in the middle
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);

if (glfwRawMouseMotionSupported())
glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);

CORE.Input.Mouse.cursorHidden = true;
}

Expand Down

0 comments on commit 887b943

Please sign in to comment.