X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Ffreeglut_init.c;h=054285e81ff4568e7fa50cf47f9877f44ac80c3c;hb=3a62f01ded704b52999ca8b22f9cd7b6abb251f5;hp=fbf906508c9923b2c7af92a46ed61226875756ac;hpb=7fdce1253e14170b6cb933f13c1f2a1644c93793;p=freeglut diff --git a/src/freeglut_init.c b/src/freeglut_init.c index fbf9065..054285e 100644 --- a/src/freeglut_init.c +++ b/src/freeglut_init.c @@ -65,11 +65,7 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ 0, /* FPSInterval */ 0, /* SwapCount */ 0, /* SwapTime */ -#if TARGET_HOST_MS_WINDOWS - { 0, GL_FALSE }, /* Time */ -#else - { { 0, 0 }, GL_FALSE }, -#endif + 0, /* Time */ { NULL, NULL }, /* Timers */ { NULL, NULL }, /* FreeTimers */ NULL, /* IdleCallback */ @@ -83,7 +79,9 @@ SFG_State fgState = { { -1, -1, GL_FALSE }, /* Position */ GLUT_EXEC_STATE_INIT, /* ExecState */ NULL, /* ProgramName */ GL_FALSE, /* JoysticksInitialised */ - GL_FALSE /* InputDevsInitialised */ + GL_FALSE, /* InputDevsInitialised */ + 0, /* AuxiliaryBufferNumber */ + 0 /* SampleNumber */ }; @@ -285,8 +283,6 @@ void fgDeinitialize( void ) fgState.GameModeDepth = 16; fgState.GameModeRefresh = 72; - fgState.Time.Set = GL_FALSE; - fgListInit( &fgState.Timers ); fgListInit( &fgState.FreeTimers ); @@ -524,7 +520,8 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) fgCreateStructure( ); - fgElapsedTime( ); + /* Get start time */ + fgState.Time = fgSystemTime(); /* check if GLUT_FPS env var is set */ #ifndef _WIN32_WCE @@ -658,6 +655,14 @@ void FGAPIENTRY glutInit( int* pargc, char** argv ) } /* + * Undoes all the "glutInit" stuff + */ +void FGAPIENTRY glutExit ( void ) +{ + fgDeinitialize (); +} + +/* * Sets the default initial window position for new windows */ void FGAPIENTRY glutInitWindowPosition( int x, int y ) @@ -717,7 +722,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) * delimited by blanks or tabs. */ char *token ; - int len = strlen ( displayMode ); + size_t len = strlen ( displayMode ); char *buffer = (char *)malloc ( (len+1) * sizeof(char) ); memcpy ( buffer, displayMode, len ); buffer[len] = '\0'; @@ -727,9 +732,16 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) { /* Process this token */ int i ; + + /* Temporary fix: Ignore any length specifications and at least + * process the basic token + * TODO: Fix this permanently + */ + size_t cleanlength = strcspn ( token, "=<>~!" ); + for ( i = 0; i < NUM_TOKENS; i++ ) { - if ( strcmp ( token, Tokens[i] ) == 0 ) break ; + if ( strncmp ( token, Tokens[i], cleanlength ) == 0 ) break ; } switch ( i ) @@ -883,7 +895,7 @@ void FGAPIENTRY glutInitDisplayString( const char* displayMode ) break ; case 36 : /* "aux": some number of aux buffers */ - glut_state_flag |= GLUT_AUX1; + glut_state_flag |= GLUT_AUX; break ; case 37 : /* Unrecognized */