Jump to content
  • Advertisement
Sign in to follow this  
123abcd1983

How to use Keyboard virtual keycodes

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

hi i got some problem by using virtual keycode, I wish to enter the "I" key , but it only tell me the "I" key value is "49", but went i put 49 to case, it didn't work. http://delphi.about.com/od/objectpascalide/l/blvkc.htm
void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown )
{
    if( bKeyDown )
    {
        switch( nChar )
        {
	   //Play button and Again button shortcut key -- Enter
	   case VK_RETURN:
	   if ( Scene == IntroScene )
	   {
               PlayStart();
	   }
	   break;

	   case 49:
	   if ( Scene == IntroScene )
	   {
		g_pIntroSound->Stop();
		playInstruction(0); 
	   }
	   break;
    }
}


Share this post


Link to post
Share on other sites
Advertisement
The 49 as referenced on the site is a hexadecimal number, so use:

case 0x49:
break;

or even easier (what I prefer)

case 'I':
break;

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!