Jump to content
  • Advertisement
Sign in to follow this  
asdqwe

[C++, Win32]Get Pressed Key- How?

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

Please post your favorite code for getting the value of the pressed key in a Win32 app. Like when you press 'A' it returns 'A' etc... (GetAsyncKeyState() only checks one key...). I *really* need it. Thanks a lot.

Share this post


Link to post
Share on other sites
Advertisement
I usually use the code from the nehe tutorials. = nehe.gamedev.net

The pressed keys are checked in the WINAPI WinMain:
if (keys['A'])
{
// do sth.
}
and the and the keys which are pressed are set in the callback function, at the message routine:

case WM_KEYDOWN
{
keys[wParam] = TRUE;
}

Share this post


Link to post
Share on other sites
Exactly! I've heard of it but I really don't know how to process it... I need a code, so then I can learn from it- but first I need CODE! I tried many times to create it and failed...
Please post some code- thanks.

Share this post


Link to post
Share on other sites
I learned it from the nehe tutorials as said,

this nehe tutorial handles keyboard input:
http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=07

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!