Skip to content

Commit

Permalink
Fix glitches when sampling relative cursor data in CAPTURED mouse mod…
Browse files Browse the repository at this point in the history
…e on Windows.
  • Loading branch information
SaracenOne committed Feb 11, 2017
1 parent b87a232 commit 523b697
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions platform/windows/os_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,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);
Expand Down

0 comments on commit 523b697

Please sign in to comment.