1
0
Fork 0

Suppress framerate while splash screen active

Don't irritate the fps-geeks while the sim isn't ready yet.
And a minor pointer safety issue.
This commit is contained in:
ThorstenB 2010-11-21 13:58:10 +01:00
parent f8c94c7729
commit dec020cd64

View file

@ -84,7 +84,7 @@ void TimeManager::init()
// frame/update-rate counters // frame/update-rate counters
_frameRate = fgGetNode("/sim/frame-rate", true); _frameRate = fgGetNode("/sim/frame-rate", true);
_lastFrameTime = _impl->get_cur_time(); _lastFrameTime = 0;
_frameCount = 0; _frameCount = 0;
} }
@ -97,6 +97,7 @@ void TimeManager::reinit()
{ {
globals->set_time_params(NULL); globals->set_time_params(NULL);
delete _impl; delete _impl;
_impl = NULL;
_inited = false; _inited = false;
globals->get_event_mgr()->removeTask("updateLocalTime"); globals->get_event_mgr()->removeTask("updateLocalTime");
@ -119,6 +120,12 @@ void TimeManager::computeTimeDeltas(double& simDt, double& realDt)
if (!wait_for_scenery) { if (!wait_for_scenery) {
throttleUpdateRate(); throttleUpdateRate();
} }
else
{
// suppress framerate while initial scenery isn't loaded yet (splash screen still active)
_lastFrameTime=0;
_frameCount = 0;
}
SGTimeStamp currentStamp; SGTimeStamp currentStamp;
currentStamp.stamp(); currentStamp.stamp();
@ -205,7 +212,7 @@ void TimeManager::update(double dt)
void TimeManager::computeFrameRate() void TimeManager::computeFrameRate()
{ {
// Calculate frame rate average // Calculate frame rate average
if ((_impl->get_cur_time() != _lastFrameTime) && (_lastFrameTime > 0)) { if ((_impl->get_cur_time() != _lastFrameTime)) {
_frameRate->setIntValue(_frameCount); _frameRate->setIntValue(_frameCount);
_frameCount = 0; _frameCount = 0;
} }