Jump to content
  • Advertisement
Sign in to follow this  
Shadekf

Key press issue

This topic is 3492 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

Hey guys, Quick question. For detecting keypess's at the moment I'm using:
#define KEY_DOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEY_UP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

And then in my game loop when I want to check if a key is pressed I use something like:
if(KEY_DOWN(VK_ESCAPE))
     PostMessage(hWnd, WM_DESTROY, 0, 0);

My question is: Is there a function I can call that will return what key was pressed? I'm making a strategy game and different keys will do different things depending on what is selected, so I want to get what key was pressed and then give it to my object to deal with rather than handling everything in the main loop. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement

This topic is 3492 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.

Guest
This topic is now closed to further replies.
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!