Sign in to follow this  
Bad Ham

Help designing input library using WM_INPUT

Recommended Posts

Bad Ham    122
Hi everyone. I'm working on my input library now, and after starting using DirectInput, I heard that using the WM_Input message to get raw input was more effective. However, I'm having a bit of an issue figuring something out. How would one check for multiple keys being pressed this way? It seems as though there's no way to make a keystate buffer and fill it when a key is pressed (unless maybe I hook WM_KEYUP also to clear the buffer?) Anyway, I'd appreciate any help as I work on getting my head around this.

Share this post


Link to post
Share on other sites
Telastyn    3777
Some of the messages have info about if shift/ctrl are pressed iirc. Otherwise yes, simple state tracking on keydown/keyup is generally the way to go.

Share this post


Link to post
Share on other sites
Bad Ham    122
Alright, I was under the impression that keydown/keyup was undesirably laggy for use in gaming situations.

That brings me to my next question. If while using raw input, I register to listen to the mouse, it seems to take exclusive control of the mouse (not very good if you're running a windowed application). Is there a way of sharing control?

Share this post


Link to post
Share on other sites
Bad Ham    122
Well, I figured that out, specificing RD_NOLEGACY for flags disables the other mouse-related windows messages from being passed, so you can't do regular windows functions. ;)

However this is bringing me to another question. I've heard a lot about the virtues of having mouse rendering decoupled from the rendering FPS so that you always have a smooth mouse displaying. Is this done through threading? Because I was under the impression that most people on this board considered threads a bad thing (from reading posts).

If so, I assume both the mouse data retrieval and the mouse rendering are in that thread? This seems a little awkward as I was under the impression that (at least for directx) you can only make rendering calls from a single thread. Given that the rest of the graphics rendering wouldn't be with this thread...I guess this would cause problems.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this