summaryrefslogtreecommitdiff
path: root/progs/redbook/polyoff.c
diff options
context:
space:
mode:
Diffstat (limited to 'progs/redbook/polyoff.c')
-rw-r--r--progs/redbook/polyoff.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/progs/redbook/polyoff.c b/progs/redbook/polyoff.c
index 42887c9e0c..280eb165ec 100644
--- a/progs/redbook/polyoff.c
+++ b/progs/redbook/polyoff.c
@@ -1,13 +1,13 @@
/*
* Copyright (c) 1993-1997, Silicon Graphics, Inc.
- * ALL RIGHTS RESERVED
- * Permission to use, copy, modify, and distribute this software for
+ * ALL RIGHTS RESERVED
+ * Permission to use, copy, modify, and distribute this software for
* any purpose and without fee is hereby granted, provided that the above
* copyright notice appear in all copies and that both the copyright notice
- * and this permission notice appear in supporting documentation, and that
+ * and this permission notice appear in supporting documentation, and that
* the name of Silicon Graphics, Inc. not be used in advertising
* or publicity pertaining to distribution of the software without specific,
- * written prior permission.
+ * written prior permission.
*
* THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS"
* AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE,
@@ -21,8 +21,8 @@
* ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE
* POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * US Government Users Restricted Rights
+ *
+ * US Government Users Restricted Rights
* Use, duplication, or disclosure by the Government is subject to
* restrictions set forth in FAR 52.227.19(c)(2) or subparagraph
* (c)(1)(ii) of the Rights in Technical Data and Computer Software
@@ -89,7 +89,7 @@ void display (void)
}
/* specify initial properties
- * create display list with sphere
+ * create display list with sphere
* initialize lighting and depth buffer
*/
void gfxinit (void)
@@ -137,7 +137,7 @@ void mouse(int button, int state, int x, int y) {
case GLUT_LEFT_BUTTON:
switch (state) {
case GLUT_DOWN:
- spinx = (spinx + 5) % 360;
+ spinx = (spinx + 5) % 360;
glutPostRedisplay();
break;
default:
@@ -147,7 +147,7 @@ void mouse(int button, int state, int x, int y) {
case GLUT_MIDDLE_BUTTON:
switch (state) {
case GLUT_DOWN:
- spiny = (spiny + 5) % 360;
+ spiny = (spiny + 5) % 360;
glutPostRedisplay();
break;
default:
@@ -209,8 +209,21 @@ void keyboard (unsigned char key, int x, int y)
}
}
+static void
+key(unsigned char k, int x, int y)
+{
+ switch (k) {
+ case 27: /* Escape */
+ exit(0);
+ break;
+ default:
+ return;
+ }
+ glutPostRedisplay();
+}
+
/* Main Loop
- * Open window with initial window size, title bar,
+ * Open window with initial window size, title bar,
* RGBA display mode, and handle input events.
*/
int main(int argc, char** argv)
@@ -223,6 +236,7 @@ int main(int argc, char** argv)
glutMouseFunc(mouse);
glutKeyboardFunc(keyboard);
gfxinit();
+ glutKeyboardFunc(key);
glutMainLoop();
return 0;
}