How can detect two keys pressed at the same time?

wasale

New member
Joined
Jun 15, 2003
Messages
2
I have made a very little game which implements one aircraft dodges many bullets coming from all direction.I create such a game by C#&Directx9,however, I have no idea how to detect users press 2 keys(i.e,left arrow and up arrow) at the same time.
Maybe it is a very simple problem to you,but to me it is a hot potato:)
Any Robin Hoods can give me a hand?
 
You cant do it with standard keyboard events because they only pass in one keycode, I think you would have to invest some time in learning DirectInput :).
 
Take a look at the GetAsyncKeyState API, it does what you need. Youll have to use p/invoke to use it.
 
Thanks a lot!!
Ill try the above 2 answers , and Ill let both of helpers know my result as soon as possible.
 
Back
Top