REVIEWED: Set mouse position to (0,0) when mouse leaves window area #5945
This commit is contained in:
parent
9f60957b84
commit
5e374218ee
1 changed files with 12 additions and 4 deletions
|
|
@ -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 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 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 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
|
static void JoystickCallback(int jid, int event); // GLFW3 Joystick Connected/Disconnected Callback
|
||||||
|
|
||||||
// Memory allocator wrappers [used by glfwInitAllocator()]
|
// 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
|
// 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;
|
if (entered)
|
||||||
else CORE.Input.Mouse.cursorOnScreen = false;
|
{
|
||||||
|
// 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
|
// GLFW3: Joystick connected/disconnected callback
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue