summaryrefslogtreecommitdiffstats
path: root/progs/redbook/teapots.c
diff options
context:
space:
mode:
authorTed Jump <[email protected]>1999-09-17 02:40:51 +0000
committerTed Jump <[email protected]>1999-09-17 02:40:51 +0000
commit83c02efa520eb2f8b3f5430be47bcd9c9749b30f (patch)
tree7e64e011d244460c4c7f3c6e177727249070c81e /progs/redbook/teapots.c
parent74783e9936c59b8098f769061c6b216cad73edcf (diff)
Added ESC key handling
Diffstat (limited to 'progs/redbook/teapots.c')
-rw-r--r--progs/redbook/teapots.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/progs/redbook/teapots.c b/progs/redbook/teapots.c
index 2431cae7350..edca5441ece 100644
--- a/progs/redbook/teapots.c
+++ b/progs/redbook/teapots.c
@@ -188,6 +188,19 @@ myReshape(int w, int h)
glMatrixMode(GL_MODELVIEW);
}
+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, RGBA display
* mode, and handle input events.
@@ -201,6 +214,7 @@ main(int argc, char **argv)
myinit();
glutReshapeFunc(myReshape);
glutDisplayFunc(display);
+ glutKeyboardFunc(key);
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}