diff options
| author | Saracen | 2017-02-11 03:54:36 +0000 |
|---|---|---|
| committer | Rémi Verschelde | 2017-03-18 20:06:40 +0100 |
| commit | 919c1d627f33a0fea0363756aaf22e5b018bd2f8 (patch) | |
| tree | ae4b8ef2a0521078f7b94a491ca1e63fa8343e21 | |
| parent | fb2173174d6c7ffef642a1b4225fae144874294c (diff) | |
| download | godot-919c1d627f33a0fea0363756aaf22e5b018bd2f8.tar.gz godot-919c1d627f33a0fea0363756aaf22e5b018bd2f8.tar.zst godot-919c1d627f33a0fea0363756aaf22e5b018bd2f8.zip | |
Fix glitches when sampling relative cursor data in CAPTURED mouse mode on Windows.
(cherry picked from commit 523b69771b16cddc4635aa4a5c2d56cefec1d394)
| -rw-r--r-- | platform/windows/os_windows.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index b56469755..ec3d9e3f7 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -394,14 +394,15 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) { if (mouse_mode==MOUSE_MODE_CAPTURED) { Point2i c(video_mode.width/2,video_mode.height/2); + old_x = c.x; + old_y = c.y; + if (Point2i(mm.x,mm.y)==c) { center=c; return 0; } Point2i ncenter(mm.x,mm.y); - mm.x = old_x + (mm.x-center.x); - mm.y = old_y + (mm.y-center.y); center=ncenter; POINT pos = { (int) c.x, (int) c.y }; ClientToScreen(hWnd, &pos); |
