[SOLVED] Help with DirectInput cursor screen position.

Started by
12 comments, last by Evil Steve 16 years, 4 months ago
Quote:Original post by Evil Steve
Sounds reasonable. Although personally I'd just use window messages and keep track of keys and buttons as they're pressed and as the mouse is moved. Pretty much the same as you have now though.


However I can't use windows messages because I'm using SDL. SDL has its own version of mouse/keyboard input control but it is buggy depending on your input settings in SDL.

Secondly I don't want to use it, especially for mouse input, since the overhead of windows constantly spamming WM_MOUSEMOVE messages is greater than a simple GetCursorPos() every tick of the game.

Thanks for the suggestions though.
Advertisement
Quote:Original post by MrDoomMaster
However I can't use windows messages because I'm using SDL. SDL has its own version of mouse/keyboard input control but it is buggy depending on your input settings in SDL.
Ah, fair enough.

Quote:Original post by MrDoomMaster
Secondly I don't want to use it, especially for mouse input, since the overhead of windows constantly spamming WM_MOUSEMOVE messages is greater than a simple GetCursorPos() every tick of the game.
Well, the application window is getting sent WM_MOUSEMOVE message all the time anyway, whether you want/use them or not. But your first point is reason enough [smile]
Quote:Original post by Evil SteveWell, the application window is getting sent WM_MOUSEMOVE message all the time anyway, whether you want/use them or not. But your first point is reason enough [smile]


Well if I wanted to go back to DirectInput and use exclusive mode on the mouse device, windows would not report the mouse messages according to the documentation. However that is out of the question, since that small benefit definitely does not outweigh the other bad things. In any case, I'm happy with what I have now. Thanks to you guys I have a great input class now. Thanks again.
Ah, I see. If I remember correctly, when you request raw input (Which DInput does), you get raw input messages instead of mouse messages (Which makes sense, since mouse messages are a higher abstraction of raw input really).

In any case, the performance difference between any of this is so small it's really not worth worrying about.

This topic is closed to new replies.

Advertisement