1
0
Fork 0

Start tracking delta time in milliseconds and passing it to the update

method of each subsystem.
This commit is contained in:
david 2002-03-30 21:22:02 +00:00
parent 9cbded8eaa
commit 6a443bb173

View file

@ -394,6 +394,12 @@ void trRenderFrame( void ) {
// Update all Visuals (redraws anything graphics related) // Update all Visuals (redraws anything graphics related)
void fgRenderFrame( void ) { void fgRenderFrame( void ) {
static long old_elapsed_ms = 0;
int dt_ms = int(globals->get_elapsed_time_ms() - old_elapsed_ms);
old_elapsed_ms = globals->get_elapsed_time_ms();
static const SGPropertyNode *longitude static const SGPropertyNode *longitude
= fgGetNode("/position/longitude-deg"); = fgGetNode("/position/longitude-deg");
static const SGPropertyNode *latitude static const SGPropertyNode *latitude
@ -596,7 +602,7 @@ void fgRenderFrame( void ) {
ssgSetNearFar( scene_nearplane, scene_farplane ); ssgSetNearFar( scene_nearplane, scene_farplane );
current_model.update(0); // FIXME: use real delta time current_model.update(dt_ms);
// $$$ begin - added VS Renganthan 17 Oct 2K // $$$ begin - added VS Renganthan 17 Oct 2K
fgUpdateDCS(); fgUpdateDCS();
@ -725,21 +731,21 @@ void fgRenderFrame( void ) {
// glDisable( GL_TEXTURE_2D ); // glDisable( GL_TEXTURE_2D );
// update the input subsystem // update the input subsystem
current_input.update(1); // FIXME: use real dt current_input.update(dt_ms);
// update the controls subsystem // update the controls subsystem
globals->get_controls()->update(1); // FIXME: use real dt globals->get_controls()->update(dt_ms);
hud_and_panel->apply(); hud_and_panel->apply();
fgCockpitUpdate(); fgCockpitUpdate();
// Use the hud_and_panel ssgSimpleState for rendering the ATC output // Use the hud_and_panel ssgSimpleState for rendering the ATC output
// This only works properly if called before the panel call // This only works properly if called before the panel call
globals->get_ATC_display()->update(1); // FIXME: use real dt globals->get_ATC_display()->update(dt_ms);
// update the panel subsystem // update the panel subsystem
if ( current_panel != NULL ) { if ( current_panel != NULL ) {
current_panel->update(1); // FIXME: use real dt current_panel->update(dt_ms);
} }
// We can do translucent menus, so why not. :-) // We can do translucent menus, so why not. :-)
@ -750,7 +756,7 @@ void fgRenderFrame( void ) {
// glEnable( GL_FOG ); // glEnable( GL_FOG );
globals->get_logger()->update(0); // FIXME: use real dt globals->get_logger()->update(dt_ms);
} }
glutSwapBuffers(); glutSwapBuffers();