Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualEvil Steve

Posted 25 October 2012 - 09:11 AM

Nooooooooooooo! Never use DirectInput for keyboard or mouse input. Just use WM_MOUSEMOVE, WM_LBUTTONDOWN and so on.

Using DirectInput will remove pointer ballistics, which will make your mouse pointer feel extremely sluggish. It's also hundreds of lines of code to set up and use, where as window messages are "free". And finally, it's actually slower than using window messages - DirectInput spawns another thread to process raw input messages, meaning it has a higher overhead.

If you're just doing this to learn DirectInput, then go ahead - but never use DirectInput for keyboard or mouse input in a shipping product.



EDIT: From here: http://msdn.microsoft.com/en-us/library/ee418864.aspx:


Summary

Overall, the best method to receive high-definition mouse movement data is WM_INPUT. If your users are just moving a mouse pointer, then consider using WM_MOUSEMOVE to avoid needing to perform pointer ballistics. Both of these window messages will work well even if the mouse isn't a high-definition mouse. By supporting high definition, Windows games can offer more precise control to users.

#1Evil Steve

Posted 25 October 2012 - 09:09 AM

Nooooooooooooo! Never use DirectInput for keyboard or mouse input. Just use WM_MOUSEMOVE, WM_LBUTTONDOWN and so on.

Using DirectInput will remove pointer ballistics, which will make your mouse pointer feel extremely sluggish. It's also hundreds of lines of code to set up and use, where as window messages are "free". And finally, it's actually slower than using window messages - DirectInput spawns another thread to process raw input messages, meaning it has a higher overhead.

If you're just doing this to learn DirectInput, then go ahead - but never use DirectInput for keyboard or mouse input in a shipping product.

PARTNERS