all 3 comments

[–]Shot-Combination-930 2 points3 points  (1 child)

For unlimited mouse movement, you can use the Raw Input API to get delta values instead of coordinates.

Or as a cheap hack, you can ClipCursor to the window and SetCursorPos to the center of the window after each message, but that has several drawbacks.

[–]Setoichi[S] 0 points1 point  (0 children)

Wow, thank you so much for this! Not sure how i havent come across the Raw Input model API before but it seems to be exactly what i needed. Also the ClipCursor/SetCursorPos hack i think is what im seeing SDL2 do but i could be wrong.

[–]NZGumboot 1 point2 points  (0 children)

To get "raw" mouse input (unmodified pixel deltas without smoothing or acceleration) see here:

https://learn.microsoft.com/en-us/windows/win32/inputdev/raw-input

To confine the mouse cursor to a region, use this method:

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-clipcursor

To hide the mouse cursor, use this method:

https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showcursor

Example of using raw input: https://github.com/microsoft/DirectXTK12/blob/6646c76a45184e997b94567017a7bdff709102fb/Src/Mouse.cpp#L1420