X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=590c2bbc77cfc3364a403a73fa4574572ea3e24b;hb=8aec061d3b95db47e642b8ac74607465bcb8dec3;hp=b23e15217ad6e515bd7662f111814415ed791342;hpb=51f26b019815f20ca524a40a0f2fa1afceb4e2dd;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index b23e152..590c2bb 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -76,6 +76,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ { { 0, 0 }, GL_FALSE }, #endif { NULL, NULL }, /* Timers */ + { NULL, NULL }, /* FreeTimers */ NULL, /* IdleCallback */ 0, /* ActiveMenus */ NULL, /* MenuStateCallback */ @@ -204,6 +205,7 @@ void fgInitialize( const char* displayName ) #endif fgJoystickInit( 0 ); + fgJoystickInit( 1 ); fgState.Initialised = GL_TRUE; } @@ -235,9 +237,15 @@ void fgDeinitialize( void ) fgDestroyStructure( ); - while( timer = ( SFG_Timer * )fgState.Timers.First ) + while( (timer = fgState.Timers.First) ) { - fgListRemove ( &fgState.Timers, &timer->Node ); + fgListRemove( &fgState.Timers, &timer->Node ); + free( timer ); + } + + while( (timer = fgState.FreeTimers.First) ) + { + fgListRemove( &fgState.FreeTimers, &timer->Node ); free( timer ); } @@ -274,7 +282,9 @@ void fgDeinitialize( void ) fgState.Time.Set = GL_FALSE; - fgState.Timers.First = fgState.Timers.Last = NULL; + fgListInit( &fgState.Timers ); + fgListInit( &fgState.FreeTimers ); + fgState.IdleCallback = NULL; fgState.MenuStateCallback = ( FGCBMenuState )NULL; fgState.MenuStatusCallback = ( FGCBMenuStatus )NULL; @@ -510,9 +520,13 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) const char *fps = getenv( "GLUT_FPS" ); if( fps ) { - sscanf( fps, "%d", &fgState.FPSInterval ); - if( fgState.FPSInterval <= 0 ) - fgState.FPSInterval = 5000; /* 5000 milliseconds */ + int interval; + sscanf( fps, "%d", &interval ); + + if( interval <= 0 ) + fgState.FPSInterval = 5000; /* 5000 millisecond default */ + else + fgState.FPSInterval = interval; } } @@ -599,15 +613,9 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) } /* - * Have the display created now. As I am too lazy to implement - * the program arguments parsing, we will have the DISPLAY - * environment variable used for opening the X display: - * - * XXX The above comment is rather unclear. We have just - * XXX completed parsing of the program arguments for GLUT - * XXX parameters. We obviously canNOT parse the application- - * XXX specific parameters. Can someone re-write the above - * XXX more clearly? + * Have the display created now. If there wasn't a "-display" + * in the program arguments, we will use the DISPLAY environment + * variable for opening the X display (see code above): */ fgInitialize( displayName );