Re: What are the key values?
Quote:
Originally posted by Unregistered
This will probably sound incredibly ignorant to most of you, but I can't seem to find the values of different keys on the keyboard. As an example, I've included the following:
...
if(kbhit())
{
key = getch();
}
if(key == 27)
{
gamestat = GAMEQUIT;
}
...
and so on. This snippet is part of a DOS console game I wrote quite awhile ago. I know that 27 is the value of the "Esc" key, and this segment tells the program to quit. But I don't know the values of others keys like the arrows. If you know anything that I don't, please reply to my post.
Thanks Everyone!!!
Do a google search for an ASCII key table -- the values between 32 and 127 are listed, and those will be the key codes.
However, arrow keys, function keys (F1, F2, etc), and those are not single characters -- rather, they send 2 characters -- a zero as the first character, and a second char which specifies the key which is hit.