From 3c9f7263e572a9d21076de821ae8f66d583e352e Mon Sep 17 00:00:00 2001 From: kernelkinetic <67117582+kernelkinetic@users.noreply.github.com> Date: Tue, 13 Oct 2020 22:26:40 +0200 Subject: [PATCH] fixed mouse movements are bound to the screen resolution (https://github.com/raysan5/raylib/issues/1392) (#1410) --- src/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/core.c b/src/core.c index 952af5610..f1d7241a4 100644 --- a/src/core.c +++ b/src/core.c @@ -5338,11 +5338,14 @@ static void *EventThread(void *arg) } // Screen confinement - if (CORE.Input.Mouse.position.x < 0) CORE.Input.Mouse.position.x = 0; - if (CORE.Input.Mouse.position.x > CORE.Window.screen.width/CORE.Input.Mouse.scale.x) CORE.Input.Mouse.position.x = CORE.Window.screen.width/CORE.Input.Mouse.scale.x; + if (!CORE.Input.Mouse.cursorHidden) + { + if (CORE.Input.Mouse.position.x < 0) CORE.Input.Mouse.position.x = 0; + if (CORE.Input.Mouse.position.x > CORE.Window.screen.width/CORE.Input.Mouse.scale.x) CORE.Input.Mouse.position.x = CORE.Window.screen.width/CORE.Input.Mouse.scale.x; - if (CORE.Input.Mouse.position.y < 0) CORE.Input.Mouse.position.y = 0; - if (CORE.Input.Mouse.position.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y) CORE.Input.Mouse.position.y = CORE.Window.screen.height/CORE.Input.Mouse.scale.y; + if (CORE.Input.Mouse.position.y < 0) CORE.Input.Mouse.position.y = 0; + if (CORE.Input.Mouse.position.y > CORE.Window.screen.height/CORE.Input.Mouse.scale.y) CORE.Input.Mouse.position.y = CORE.Window.screen.height/CORE.Input.Mouse.scale.y; + } // Gesture update if (gestureUpdate)