Monday, May 24, 2010

Detecting simultaneous keypresses using C++/WinAPI?

I am creating a simple game in WinAPI (required for a class to use no DX/OpenGL), and I'm trying to detect when more than one key is pressed at the same time.





Currently if I hold down the UP button, and press with LEFT button, the LEFT button will interrupt the action UP was supposed to be performing. It is currently set up using a switch statement and checking for VK_UP/VK_LEFT.





Is there any way I can have it alternate between both actions instead of only performing one ?

Detecting simultaneous keypresses using C++/WinAPI?
The short answer is raw input (see link below). The VK_ window messages are sorta deprecated in favor processing raw input and for games I'd definitely avoid using the default window messages.


Also, have you looked at directinput? I don't know if dx10 has dropped that project or not.


No comments:

Post a Comment