diff options
Diffstat (limited to 'progs/redbook/stroke.c')
-rw-r--r-- | progs/redbook/stroke.c | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/progs/redbook/stroke.c b/progs/redbook/stroke.c index d8c75c89fe..19b0391cba 100644 --- a/progs/redbook/stroke.c +++ b/progs/redbook/stroke.c @@ -3,14 +3,14 @@ /* * (c) Copyright 1993, 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, @@ -24,8 +24,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 @@ -38,10 +38,10 @@ * OpenGL(TM) is a trademark of Silicon Graphics, Inc. */ /* - * stroke.c - * This program demonstrates some characters of a + * stroke.c + * This program demonstrates some characters of a * stroke (vector) font. The characters are represented - * by display lists, which are given numbers which + * by display lists, which are given numbers which * correspond to the ASCII values of the characters. * Use of glCallLists() is demonstrated. */ @@ -59,7 +59,7 @@ typedef struct charpoint { } CP; CP Adata[] = { - { 0, 0, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT}, + { 0, 0, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 0, STROKE}, {0, 5, PT}, {5, 5, END} }; @@ -69,18 +69,18 @@ CP Edata[] = { }; CP Pdata[] = { - {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, + {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, {4, 5, PT}, {0, 5, END} }; CP Rdata[] = { - {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, + {0, 0, PT}, {0, 10, PT}, {4, 10, PT}, {5, 9, PT}, {5, 6, PT}, {4, 5, PT}, {0, 5, STROKE}, {3, 5, PT}, {5, 0, END} }; CP Sdata[] = { - {0, 1, PT}, {1, 0, PT}, {4, 0, PT}, {5, 1, PT}, {5, 4, PT}, - {4, 5, PT}, {1, 5, PT}, {0, 6, PT}, {0, 9, PT}, {1, 10, PT}, + {0, 1, PT}, {1, 0, PT}, {4, 0, PT}, {5, 1, PT}, {5, 4, PT}, + {4, 5, PT}, {1, 5, PT}, {0, 6, PT}, {0, 9, PT}, {1, 10, PT}, {4, 10, PT}, {5, 9, END} }; @@ -163,8 +163,21 @@ static void reshape(GLsizei w, GLsizei h) glLoadIdentity(); } +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) @@ -176,6 +189,7 @@ int main(int argc, char** argv) myinit (); glutDisplayFunc(display); glutReshapeFunc(reshape); + glutKeyboardFunc(key); glutMainLoop(); return 0; /* ANSI C requires main to return int. */ } |