ASCII values for arrow keys

So, does anyone know the values used for the arrow keys, i don’t think that they are ASCII but maybe they are. Oh, and anyone know of any tuts on glaux.h?

If you use glut for your keyboard input they are definded under glutSpecialFunc() as GLUT_KEY_DOWN, GLUT_KEY_UP and GLUT_KEY_LEFT AND GLUT_KEY_RIGHT.

On glaux, ton’s of stuff on it, just do a search. But glaux library is out dated and should not be used. glaux was replaced by the glut library, the glut library has functions that where in the glaux, except the BMP loading function.

Originally posted by Eclipix:
So, does anyone know the values used for the arrow keys, i don’t think that they are ASCII but maybe they are. Oh, and anyone know of any tuts on glaux.h?

You’re right… they’re not ASCII. What you’re after are key codes. In the case of microsoft they are virtual key kodes (VK_UP, VK_LEFT, etc.). The reason that they’re not ASCII codes is that they have a wide variety of meanings… really what you’re after is the keypress event, not the character (if any) which it was mapped to by the OS (which might be none, or many).

Hmm, the letter ‘a’ can have many meanings
also :}

The arrow keys are part of the extended keyboard so they return extended key codes. In english that means that when you press one of them it actually returns two key codes, the first is allways 0 then the next is the actual key code. The reason for this is that the key codes for the arrow keys are the same as some of the letter keys. So when you get a key code of 0 you no to get another key code and use it eg.

if ( getch() == 0 )
{
ch = getch();

if ( ch == 85 ) //up I think
do something…
}
else
normal key…

All this said if your working in win32 then all of what I have said is useless and use the key codes:
VK_LEFT
VK_UP
VK_DOWN
VK_RIGHT