#include #include "vgl.h" #include "Lines.h" extern Lines starburst_G; extern float theta_G; extern void MakeWheel(); using namespace std; void SpecialKeypress(int key, int x, int y) { return; } void KeyUp(unsigned char key, int x, int y) { return; } void SpecialUp(int key, int x, int y) { return; } bool DoAnimation = false; int delay = 1000/60; void Animate(int value) { theta_G += 0.5; if(DoAnimation) { glutTimerFunc(delay, Animate,0); } glutPostRedisplay(); return; } void StartAnimation() { glutTimerFunc(delay, Animate,0); DoAnimation = true; return; } void StopAnimation() { DoAnimation = false;; return; } void KeyHelp() { cout << endl; cout << "Keys " << endl; cout << "\ta\tStart Animation" << endl; cout << "\tA\tStop Animation" << endl; cout << "\tw\tAdd a wheel" << endl; cout << "\tq,Q\tQuit" << endl; cout << "\th,?\tHelp" << endl; cout << "\tr,R\tRedisplay" << endl; cout << endl; return; } void Keypress(unsigned char key, int x, int y) { static int state = 1; bool redisplay = false; switch (key) { case 'w': MakeWheel(); break; case 'a': StartAnimation(); break; case 'A': StopAnimation(); break; case 'h': case '?': KeyHelp(); break; case 'Q': case 'q': exit(0); case 'r': case 'R': redisplay = true; break; default: cerr << "Unhandled keypress for key '" << key << "'" << endl; } if (redisplay) { glutPostRedisplay(); } return; }