#include #include #include #include using namespace std; void display() { } void myinit() { } void specialkeypress(int c, int x, int y) { switch (c) { case GLUT_KEY_F1: cout << "F1" ; break; case GLUT_KEY_F2: cout << "F2" ; break; case GLUT_KEY_F3: cout << "F3" ; break; case GLUT_KEY_F4: cout << "F4" ; break; case GLUT_KEY_F5: cout << "F5" ; break; case GLUT_KEY_F6: cout << "F6" ; break; case GLUT_KEY_F7: cout << "F7" ; break; case GLUT_KEY_F8: cout << "F8" ; break; case GLUT_KEY_F9: cout << "F9" ; break; case GLUT_KEY_F10: cout << "F10" ; break; case GLUT_KEY_F11: cout << "F11" ; break; case GLUT_KEY_F12: cout << "F12" ; break; case GLUT_KEY_LEFT: cout << "Left"; break; case GLUT_KEY_RIGHT: cout << "Right"; break; case GLUT_KEY_UP: cout << "Up"; break; case GLUT_KEY_DOWN: cout << "Down"; break; case GLUT_KEY_PAGE_UP: cout << "Page up"; break; case GLUT_KEY_PAGE_DOWN: cout << "Page down"; break; case GLUT_KEY_HOME: cout << "Home"; break; case GLUT_KEY_END: cout << "End"; break; case GLUT_KEY_INSERT: cout << "Insert"; break; } cout << " pressed at (" << x << ", " << y << ")" << endl; } void keypress(unsigned char c, int x, int y) { int mods; cout << c << " pressed at (" << x << ", " << y << ")" << endl; mods = glutGetModifiers(); if(mods & GLUT_ACTIVE_SHIFT) { cout << "\tThe shift key was pressed."<< endl; } if(mods & GLUT_ACTIVE_CTRL) { cout << "\tThe control key was pressed."<< endl; } if(mods & GLUT_ACTIVE_ALT) { cout << "\tThe alt key was pressed."<< endl; } switch (c) { case 'q': exit(0); } glutPostRedisplay(); } void mouse(int button, int state, int x, int y) { switch (button) { case GLUT_LEFT_BUTTON: cout << "Left button "; break; case GLUT_MIDDLE_BUTTON: cout << "Middle button "; break; case GLUT_RIGHT_BUTTON: cout << "Right button "; break; } switch(state) { case GLUT_DOWN : cout << "Pushed down "; break; case GLUT_UP : cout << "Let up "; break; } cout << "At (" << x << ", " << y <<")" << endl; } void mouseEntry(int state) { if(state == GLUT_LEFT) { cout << "The mouse just left the window " << endl; } if (state == GLUT_ENTERED) { cout << "The mouse just entered the window " << endl; } } void mouseMotion(int x, int y) { cout << "Button down motion at ("<