Hi everyone,
I've tried to use the following code for allowing my mouse to move the camera look direction:
case WM_MOUSEMOVE: //Mouse movement for camera GetCursorPos(&currMousePos); mouseDeltaX = currMousePos.x - lastMousePos.x; mouseDeltaY = currMousePos.y - lastMousePos.y; //Find how much the mouse has moved lastMousePos = currMousePos; SetCursorPos(GetSystemMetrics(SM_CXSCREEN)/2, GetSystemMetrics(SM_CYSCREEN)/2); //Reset the cursor to the window centre break;
This doesn't seem to work though. I think the reason is that the function SetCursorPos() also causes a WM_MOUSEMOVE message to be sent, which means that the net movement each time is zero. What's the best way to make a simple mouselook function in C++? All I need at the moment is to determine how much the mouse has moved from its last position every time it moves. I think when I get that sorted, I will be able to take it from there!
Thanks!






