[SlimDX]Raw Input or Windows Messages?

Started by
2 comments, last by Headkaze 15 years, 5 months ago
I just came from XNA and its nice wrappers for getting user input. Now, using SlimDX, without the nice XNA wrappers, I am confused on what would be the best way to get user input. A book I have uses windows messages to get keyboard and mouse input. I also took a look at SlimDX's Raw Input wrappers. I am left with a lot of questions 1) Is it harder to use raw input than windows messages? Will I spend a lot more time? Is it more error prone? Or, is it easier than or only slightly different than using windows messages? 2) What are the pros and Cons to using each/which one do you prefer and why? 3) Are there any good articles on the subject of Raw Input that might help me (other than MSDN's article)? Thanks, jdub
J.W.
Advertisement
The key issue here is that each are good for different things. Generally you'll want to use windows messages for pretty much anything that's not gameplay. For example if you have a mouse cursor for navigating menus, you'll want to use windows messages so that you get ballistics applied to the cursor movement (ballistics causes the pointer to accelerate, without it the mouse will feel very "weird" compared to the windows cursor). For textboxes where the player enters a name or some information, you'll once again want standard windows messages input. That's because this will automatically take care of things like capslock/shift, key repeat, and international keyboards.

Now for gameplay, for instance a first-person shooter where you use mouse input to control free-look, you'll probably want to use Raw Input. In this case you don't have a cursor so you don't want ballistics applied, so that's not an issue. You'll also want to be able to take advantage of high-DPI mouse hardware, which you can only do through Raw Input. Same with the keyboard, where you'll probably just want to know what button is being pressed and you don't care about capitalization or key repeats.
So let me get this right:

Raw Input is lower level than using Windows Messages for input and only gives basic information about input?

So Unless I am designing a First Person Shooter or something similar, I should not use Raw Input?

J.W.
Another thing to note about Raw Input is that is supports multiple mouse and keyboards. Windows messages treats them as a single input device.

This topic is closed to new replies.

Advertisement