mirror of
https://github.com/raysan5/raylib.git
synced 2026-07-05 08:55:14 +00:00
REVIEWED: Set mouse position to (0,0) when mouse leaves window area #5945
This commit is contained in:
@@ -151,7 +151,7 @@ static void CharCallback(GLFWwindow *window, unsigned int codepoint);
|
||||
static void MouseButtonCallback(GLFWwindow *window, int button, int action, int mods); // GLFW3 Mouse Button Callback, runs on mouse button pressed
|
||||
static void MouseCursorPosCallback(GLFWwindow *window, double x, double y); // GLFW3 Cursor Position Callback, runs on mouse move
|
||||
static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffset); // GLFW3 Scrolling Callback, runs on mouse wheel
|
||||
static void CursorEnterCallback(GLFWwindow *window, int enter); // GLFW3 Cursor Enter Callback, cursor enters client area
|
||||
static void CursorEnterCallback(GLFWwindow *window, int entered); // GLFW3 Cursor Enter Callback, cursor enters client area
|
||||
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
||||
|
||||
// Memory allocator wrappers [used by glfwInitAllocator()]
|
||||
@@ -2167,10 +2167,18 @@ static void MouseScrollCallback(GLFWwindow *window, double xoffset, double yoffs
|
||||
}
|
||||
|
||||
// GLFW3: Cursor ennter callback, when cursor enters the window
|
||||
static void CursorEnterCallback(GLFWwindow *window, int enter)
|
||||
static void CursorEnterCallback(GLFWwindow *window, int entered)
|
||||
{
|
||||
if (enter) CORE.Input.Mouse.cursorOnScreen = true;
|
||||
else CORE.Input.Mouse.cursorOnScreen = false;
|
||||
if (entered)
|
||||
{
|
||||
// NOTE: Mouse position updated by MouseCursorPosCallback()
|
||||
CORE.Input.Mouse.cursorOnScreen = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CORE.Input.Mouse.cursorOnScreen = false;
|
||||
CORE.Input.Mouse.currentPosition = (Vector2){ 0 };
|
||||
}
|
||||
}
|
||||
|
||||
// GLFW3: Joystick connected/disconnected callback
|
||||
|
||||
Reference in New Issue
Block a user