瀏覽代碼

Put GLFW in relative mouse mode when the cursor is disabled. (#3874)

Jeffery Myers 1 年之前
父節點
當前提交
9bb3d9977a
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      src/platforms/rcore_desktop.c

+ 6 - 0
src/platforms/rcore_desktop.c

@@ -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;
 }
 
@@ -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;
 }