mirror of
https://github.com/raysan5/raylib.git
synced 2026-01-21 23:07:14 -05:00
fix: cursor lock/unlock inconsistent behaviour on glfw, rgfw, sl (#5323)
This commit is contained in:
@ -1070,6 +1070,7 @@ void EnableCursor(void)
|
|||||||
|
|
||||||
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);
|
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_FALSE);
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorHidden = false;
|
||||||
CORE.Input.Mouse.cursorLocked = false;
|
CORE.Input.Mouse.cursorLocked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1083,6 +1084,7 @@ void DisableCursor(void)
|
|||||||
|
|
||||||
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
if (glfwRawMouseMotionSupported()) glfwSetInputMode(platform.handle, GLFW_RAW_MOUSE_MOTION, GLFW_TRUE);
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorHidden = true;
|
||||||
CORE.Input.Mouse.cursorLocked = true;
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -838,8 +838,9 @@ void EnableCursor(void)
|
|||||||
|
|
||||||
// Set cursor position in the middle
|
// Set cursor position in the middle
|
||||||
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
SetMousePosition(CORE.Window.screen.width/2, CORE.Window.screen.height/2);
|
||||||
RGFW_window_showMouse(platform.window, true);
|
ShowCursor();
|
||||||
CORE.Input.Mouse.cursorHidden = false;
|
|
||||||
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disables cursor (lock cursor)
|
// Disables cursor (lock cursor)
|
||||||
@ -848,6 +849,8 @@ void DisableCursor(void)
|
|||||||
RGFW_disableCursor = true;
|
RGFW_disableCursor = true;
|
||||||
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
RGFW_window_mouseHold(platform.window, RGFW_AREA(0, 0));
|
||||||
HideCursor();
|
HideCursor();
|
||||||
|
|
||||||
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Swap back buffer with front buffer (screen drawing)
|
// Swap back buffer with front buffer (screen drawing)
|
||||||
|
|||||||
@ -1237,13 +1237,7 @@ void EnableCursor(void)
|
|||||||
{
|
{
|
||||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||||
|
|
||||||
#if defined(USING_VERSION_SDL3)
|
ShowCursor();
|
||||||
// NOTE: SDL_ShowCursor() has been split into three functions:
|
|
||||||
// SDL_ShowCursor(), SDL_HideCursor(), and SDL_CursorVisible()
|
|
||||||
SDL_ShowCursor();
|
|
||||||
#else
|
|
||||||
SDL_ShowCursor(SDL_ENABLE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CORE.Input.Mouse.cursorLocked = false;
|
CORE.Input.Mouse.cursorLocked = false;
|
||||||
}
|
}
|
||||||
@ -1253,6 +1247,9 @@ void DisableCursor(void)
|
|||||||
{
|
{
|
||||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||||
|
|
||||||
|
HideCursor();
|
||||||
|
|
||||||
|
platform.cursorRelative = true;
|
||||||
CORE.Input.Mouse.cursorLocked = true;
|
CORE.Input.Mouse.cursorLocked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user