diff options
author | Ted Jump <[email protected]> | 1999-09-17 02:40:51 +0000 |
---|---|---|
committer | Ted Jump <[email protected]> | 1999-09-17 02:40:51 +0000 |
commit | 83c02efa520eb2f8b3f5430be47bcd9c9749b30f (patch) | |
tree | 7e64e011d244460c4c7f3c6e177727249070c81e /progs/redbook/teapots.c | |
parent | 74783e9936c59b8098f769061c6b216cad73edcf (diff) |
Added ESC key handling
Diffstat (limited to 'progs/redbook/teapots.c')
-rw-r--r-- | progs/redbook/teapots.c | 14 |
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. */ } |