From: John F. Fay Date: Mon, 26 Nov 2007 08:09:45 +0000 (+0000) Subject: Making a demo program that uses "glutMainLoopEvent" X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=3a62f01ded704b52999ca8b22f9cd7b6abb251f5;p=freeglut Making a demo program that uses "glutMainLoopEvent" git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@736 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/progs/demos/Fractals/fractals.c b/progs/demos/Fractals/fractals.c index 0852f1a..1aef1c4 100644 --- a/progs/demos/Fractals/fractals.c +++ b/progs/demos/Fractals/fractals.c @@ -39,6 +39,9 @@ static int num_levels = 0 ; static int num_trans ; static AffineTrans *affine ; +/* Flag telling us to keep executing the main loop */ +static int continue_in_main_loop = 1; + /* the window title */ char window_title [ 80 ] ; @@ -125,7 +128,7 @@ Key(unsigned char key, int x, int y) switch (key) { case 27: /* Escape key */ - glutLeaveMainLoop () ; + continue_in_main_loop = 0 ; break; case '+' : @@ -321,7 +324,11 @@ main(int argc, char *argv[]) glutSpecialFunc(Special); glutDisplayFunc(Display); - glutMainLoop(); +#ifdef WIN32 +#endif + + while ( continue_in_main_loop ) + glutMainLoopEvent(); printf ( "Back from the 'freeglut' main loop\n" ) ;