From 872dbbc4ad91e92f1a370c82ffaf086400b4cd58 Mon Sep 17 00:00:00 2001 From: fayjf Date: Mon, 26 Nov 2007 08:09:45 +0000 Subject: [PATCH] Making a demo program that uses "glutMainLoopEvent" git-svn-id: https://svn.code.sf.net/p/freeglut/code/trunk@736 7f0cb862-5218-0410-a997-914c9d46530a --- freeglut/freeglut/progs/demos/Fractals/fractals.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/freeglut/freeglut/progs/demos/Fractals/fractals.c b/freeglut/freeglut/progs/demos/Fractals/fractals.c index 0852f1a..1aef1c4 100644 --- a/freeglut/freeglut/progs/demos/Fractals/fractals.c +++ b/freeglut/freeglut/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" ) ;