- if (button == GLUT_MIDDLE_BUTTON) {\r
- if (state == GLUT_DOWN) {\r
- lightMoving = 1;\r
- lightStartX = x;\r
- lightStartY = y;\r
- }\r
- if (state == GLUT_UP) {\r
- lightMoving = 0;\r
- }\r
+}\r
+\r
+/**\r
+ * Keybord event handler\r
+ * w/s increase/decrease the z\r
+ * a/d increase/decrease the x\r
+ * q/e increase/decrease the y\r
+ * z/x increase/decrease the angle\r
+ * @param key Key pressed\r
+ * @param x x co-ordinate of mouse\r
+ * @param y y co-ordinate of mouse\r
+ */\r
+void keyboard(unsigned char key, int x, int y) {\r
+ switch(key) {\r
+ case 'w':\r
+ case 'W':\r
+ camz -= factor;\r
+ break;\r
+ case 'a':\r
+ case 'A':\r
+ camx -= factor;\r
+ break;\r
+ case 's':\r
+ case 'S':\r
+ camz += factor;\r
+ break;\r
+ case 'd':\r
+ case 'D':\r
+ camx += factor;\r
+ break;\r
+ case 'q':\r
+ case 'Q':\r
+ camy += factor;\r
+ break;\r
+ case 'e':\r
+ case 'E':\r
+ camy -= factor;\r
+ break;\r
+ case 'z':\r
+ case 'Z':\r
+ keyrot += factor;\r
+ break;\r
+ case 'x':\r
+ case 'X':\r
+ keyrot -= factor;\r
+ break;\r
+ case '=':\r
+ case '+':\r
+ factor += 0.1;\r
+ printf("Factor of change is now %f\n", factor);\r
+ break;\r
+ case '-':\r
+ case '_':\r
+ factor -= 0.1;\r
+ printf("Factor of change is now %f\n", factor);\r
+ break;\r
+\r