I wrote 2 weeks ago about problem with motion blur in my engine. When camera moves using keyboard, motion blur is smooth. But when I rotate camera using mouse motion blur is stepping (not sure if I used proper term). Now I rethink my problem and it brings me new questions.

To rotate camera I use mouse delta which is difference between last position and current position. But it is expressed in pixels. Furthermore WinAPI events doesn't have per-pixel precision.

I saw that engines uses it's own screen coordinates which is float-based (http://www.esenthel.com/wiki/index.php?title=Screen_Coordinates). I checked that and I see that even small movement (smaller than 1 pixel) is detected. I believe that this is the solution to my motion blur problem and also with another further problems (for example different size of GUI components on different resolutions).

And here is my question. How can I get such mouse precision? I read about WM_INPUT and dividing delta by mouse DPI, but there are two problems - we can't get mouse DPI using WinAPI and mouse event still return value in pixels.

Where can I find some informations or example of solving this problem?


1 Answer 1


Yes, you should use WM_INPUT for things like camera movement. Why? Because it doesn't matter what the mouse's factory DPI is. Pretty much all games give the user a "mouse sensitivity" setting, where they can tweak a custom DPI value (they don't need to know it's the DPI!) to fit their preferences.

When it comes to GUI, you should still use the WM_MOUSEMOVE data. This will let the user use an in-game cursor that acts in the exact same way to their cursor outside of the game.

As far as supporting multiple resolutions goes, you can just divide the cursor position by the real screen resolution (and maybe some more transformations) to get normalized coordinates that work regardless of resolution. A good, adaptive UI should already be designed using normalized coordinates so that any resolution is supported flawlessly.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .