From 7acf78c68c2646e6ea67879cbb5873793f486840 Mon Sep 17 00:00:00 2001 From: Dave Palais <95749687+dpalais@users.noreply.github.com> Date: Fri, 15 Sep 2023 01:06:58 -0500 Subject: [PATCH] Also reset the mouse delta position each frame (#740) Reset and accumulate the mouse position delta every frame Co-authored-by: Dave Palais --- WickedEngine/wiSDLInput.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/WickedEngine/wiSDLInput.cpp b/WickedEngine/wiSDLInput.cpp index 5a93caef0..1bd5d8cd1 100644 --- a/WickedEngine/wiSDLInput.cpp +++ b/WickedEngine/wiSDLInput.cpp @@ -45,6 +45,7 @@ namespace wi::input::sdlinput void Update() { mouse.delta_wheel = 0; // Do not accumulate mouse wheel motion delta + mouse.delta_position = XMFLOAT2(0, 0); // Do not accumulate mouse position delta for(auto& event : events){ switch(event.type){ @@ -75,8 +76,8 @@ namespace wi::input::sdlinput case SDL_MOUSEMOTION: // Mouse moved mouse.position.x = event.motion.x; mouse.position.y = event.motion.y; - mouse.delta_position.x = event.motion.xrel; - mouse.delta_position.y = event.motion.yrel; + mouse.delta_position.x += event.motion.xrel; + mouse.delta_position.y += event.motion.yrel; break; case SDL_MOUSEBUTTONDOWN: // Mouse button pressed switch(event.button.button){