12 minutes ago, b2soft said:
In case there are not only mouse-look camera
How do you mean this? What would be an example?
Capturing the mouse does not help, the additional WM_MOSEMOVE is still geneareted on SetCursorPos.
EDIT: In fact i do what i think you mean with capturing. So if the mouse pointer goes out the window on the right, it comes in at the left. But at this point i have to use SetCursorPos to make that jump happen, so the 'problem' presists.
I do this so i can drag gizmos as long as i want without getting stopped if mouse cursor hits the edges of the screen. (code below - the comments indicate that i stumbled over the same problem )
if (uMsg == WM_MOUSEMOVE)
{
if (globalApplication->MouseCaptured())
{
RECT winRect;
GetClientRect (hWnd, &winRect);
ClientToScreen (hWnd, (LPPOINT)&winRect.left);
ClientToScreen (hWnd, (LPPOINT)&winRect.right);
ClipCursor (&winRect);
POINT curpos;
GetCursorPos(&curpos);
int width = max (3, winRect.right - winRect.left);
int height = max (3, winRect.bottom - winRect.top);
bool moved = false;
if (curpos.x <= winRect.left) {curpos.x += (width-2); globalApplication->mouseMulX++; moved = true;}
else if (curpos.x >= winRect.left + width - 1) {curpos.x -= (width-2); globalApplication->mouseMulX--; moved = true;}
if (curpos.y <= winRect.top) {curpos.y += (height-2); globalApplication->mouseMulY++; moved = true;}
else if (curpos.y >= winRect.top + height - 1) {curpos.y -= (height-2); globalApplication->mouseMulY--; moved = true;}
globalApplication->SetMousePosition (
curpos.x - winRect.left - globalApplication->mouseMulX * (width-2),
curpos.y - winRect.top - globalApplication->mouseMulY * (height-2) );
if (moved)
{
SetCursorPos (curpos.x,curpos.y); // creates a new WM_MOUSEMOVE message
//UpdateWindow(hWnd); // force WM_PAINT over WM_MOUSEMOVE
}
}
else
{
ClipCursor (0);
globalApplication->mouseMulX = 0;
globalApplication->mouseMulY = 0;
globalApplication->SetMousePosition (LOWORD (lParam), HIWORD (lParam));
}
}