Jump to content
  • Advertisement
Sign in to follow this  
sosa

WM_INPUT help needed

This topic is 2463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

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.

Does anyone have any opinions on WM_INPUT, working examples, or opinions on windows input in general.

Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I doubt WM_INPUT is to blame for this. At the very most, you're doing something pathological in your window procedure when handling WM_INPUT, which leads to these symptoms; but without seeing your code, it's anyone's guess as to what exactly you may be doing that needs to change.

Share this post


Link to post
Share on other sites
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.
I disagree. I think raw input is just what I need. Problem is understanding what it isn't. My problems are amplified by the fact I am not a standard keyboard user.

WM_INPUT is not a good way to emulate WM_CHAR. CHAR messages contain considerable more information, are generated way differently and go through consistent mangling. Do not map WM_INPUT to WM_CHAR. It is possible, but just not necessary, just get WM_CHAR. What is WM_CHAR for?
WM_CHAR says "append character 'x' to text buffer". Or perhaps, if caps lock is on "append character 'X' to text buffer". Both chars are generated by the same button.
For your information (I assume you're writing from QWERTY-US), my keyboard would generate 'q' and 'Q' respectively.
This is what WM_CHAR does, it looks at the buttons being pressed and maps to the appropriate character. It also takes appropriate consideration of control panel settings regarding keyboard repetition speed and stuff like that.

WM_INPUT does nothing like that. The misconception arises as most people never have to deal with anything else than QWERTY-US. WM_INPUT always identify buttons, not characters, based on (apparently) a standard QWERTY-US layout.
So, button C will generate 'c' in QWERTY-US and 'j' in my keyboard layout, but it's always in the same physical position. This is very important, it implies your keyboard mappings will never, ever change because of locale. Your WASD cross will always be a cross, even if the buttons are marked differently.

Do not bind actions by characters. For first, what's the deal with 'c' against 'C'? What happens if the user has a different keyboard layout?

For all text-related purposes, I think WM_CHAR is just the best option.
Personally I use WM_INPUT for hi-prec mouse movement only.

Share this post


Link to post
Share on other sites
Thank you all for the spirited posts! Will review in detail and respond later today.

Share this post


Link to post
Share on other sites
Krohm

Can you provide an example of how you use WM_INPUT for [color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

hi-prec mouse movement?

[/font]


[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif]

Thanks in advance!

[/font]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!