Search code examples
c++charfreeglut

list of key constants


I want to check for Key-Events like pressing up / pressing down ...

But the function, which I created to be called, gets a "unsigned char". I am able to check for keys like W/A/S/D with key == 'w', but I don't know how to check for other keys.

Is there any list of available chars, like "\n"?


Solution

  • You can find a list of character escape sequences here.

    Note that some keys have to be handled using glutSpecialFunc()/glutSpecialUpFunc(), for whose handler the following applies:

    The key argument may take one of the following defined constant values:

    • GLUT_KEY_F1, GLUT_KEY_F2, ..., GLUT_KEY_F12 - F1 through F12 keys
    • GLUT_KEY_PAGE_UP, GLUT_KEY_PAGE_DOWN - Page Up and Page Down keys
    • GLUT_KEY_HOME, GLUT_KEY_END - Home and End keys
    • GLUT_KEY_LEFT, GLUT_KEY_RIGHT, GLUT_KEY_UP, GLUT_KEY_DOWN - Arrow keys
    • GLUT_KEY_INSERT - Insert key