Wondering about pros and cons and personal preferences on how to capture input?
Thanks
Thanks
This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.
The post was edited 1 time, last by Shanee ().
Originally posted by sosa
I have implemented two different ways of using WM_INPUT for capturing Kbd and Mouse messages however in both the mouse is unresponsive when the app is running although clicks, dbl-clicks, and key strokes are captured. I am not sure why the app hangs and why I can't do simple things like drag the window or maximize it.
I'm not sure what's up with this without being able to see the code. Are you letting the default windows procedure handle this event as well? What are the exact symptoms you're seeing? If you want to post your window proc function, that would help.
Using WM_INPUT is not easy, and I am also wondering if it makes more sense to just capture WM_LBUTTONDOWN and WM_CHAR messages since my game is a 2D platformer and doesn't need super fast input handling for the game play.
That's probably fine, just not very scalable. It's basically what we did in the book. Once the code is published, take a look at HumanView::VOnMsgProc() in HumanView.cpp, somewhere around line 225, to see how we handle input. WM_KEYDOWN and WM_KEYUP handle more things, while WM_CHAR is only used for the console.
Does anyone have any opinions on WM_INPUT, working examples, or opinions on windows input in general.
I've done it before, but I don't recall the specifics. As I said in my earlier post, I ended up just continuing with DirectInput in my own projects. There's not enough of a reason for me to rip out and refactor code that works just fine. Using the Windows message system is a bit of a pain and architecturally very different than DirectInput, so I'd have to completely change my input abstraction layer.
If you just want something that works, take a look at that HumanView::VOnMsgProc() function.
-Rez