I have a problem with implementing mouse-look camera movement, like in FPS games. For me common solution is:
- Process
WM_MOUSEMOVE
event inWndProc
- Calculate delta movement from the window's center using event's
lParam
- Rotate camera
- Return cursor back to window's center using
SetCursorPos
The problem is when SetCursorPos
is called, another WM_MOUSEMOVE
event is being fired. So camera rotates back.
What is the common way to create such type of camera on Windows platform (using WinAPI)?
I know that in WM_MOSEMOVE
I can check is mouse.x == windowCenter.x
and if it is - do nothing, but it's a hack from my point of view. Is there any "non-hacky" way to achieve the goal?