X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=freeglut-1.3%2Ffreeglut_callbacks.c;h=743077a5eb2f73bd36f68cbe168037efef44ad81;hb=5e894684e34e8934ae876f3c91cceb633267a05f;hp=f61bfb83aab7af649bf1a5702fddeb05d8abd73e;hpb=c90e3f21e02020232054f78029ef9071c7359cfb;p=freeglut diff --git a/freeglut-1.3/freeglut_callbacks.c b/freeglut-1.3/freeglut_callbacks.c index f61bfb8..743077a 100644 --- a/freeglut-1.3/freeglut_callbacks.c +++ b/freeglut-1.3/freeglut_callbacks.c @@ -100,7 +100,7 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ), i /* * Create a new freeglut timer hook structure */ - timer = g_new0( SFG_Timer, 1 ); + timer = calloc( sizeof(SFG_Timer), 1 ); /* * Remember the callback address and timer hook's ID @@ -111,13 +111,12 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ), i /* * When will the time out happen (in terms of window's timer) */ - timer->TriggerTime = - g_timer_elapsed( fgState.Timer, NULL ) + (((double) timeOut) / 1000.0); + timer->TriggerTime = fgElapsedTime() + timeOut; /* * Have the new hook attached to the current window */ - fgState.Timers = g_list_append( fgState.Timers, timer ); + fgListAppend( &fgState.Timers, &timer->Node ); } /* @@ -126,7 +125,7 @@ void FGAPIENTRY glutTimerFunc( unsigned int timeOut, void (* callback)( int ), i * I had to peer to GLUT sources to clean up the mess. * Can anyone please explain me what is going on here?!? */ -static void fghVisibility( gint status ) +static void fghVisibility( int status ) { freeglut_assert_ready; freeglut_return_if_fail( fgStructure.Window != NULL ); freeglut_return_if_fail( fgStructure.Window->Callbacks.Visibility != NULL ); @@ -175,13 +174,13 @@ void FGAPIENTRY glutJoystickFunc( void (* callback)( unsigned int, int, int, int /* * Do not forget setting the joystick poll rate */ - fgStructure.Window->State.JoystickPollRate = ((double) pollInterval) / 1000.0; + fgStructure.Window->State.JoystickPollRate = pollInterval; /* * Make sure the joystick polling routine gets called as early as possible: */ fgStructure.Window->State.JoystickLastPoll = - g_timer_elapsed( fgState.Timer, NULL ) - fgStructure.Window->State.JoystickPollRate; + fgElapsedTime() - fgStructure.Window->State.JoystickPollRate; if( fgStructure.Window->State.JoystickLastPoll < 0.0 ) fgStructure.Window->State.JoystickLastPoll = 0.0; @@ -224,7 +223,9 @@ void FGAPIENTRY glutEntryFunc( void (* callback)( int ) ) */ void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) ) { - SET_CALLBACK( MenuState ); + freeglut_assert_ready; + + fgState.MenuStateCallback = callback; } /* @@ -232,7 +233,9 @@ void FGAPIENTRY glutMenuStateFunc( void (* callback)( int ) ) */ void FGAPIENTRY glutMenuStatusFunc( void (* callback)( int, int, int ) ) { - SET_CALLBACK( MenuStatus ); + freeglut_assert_ready; + + fgState.MenuStatusCallback = callback; } /*