|
|
|
@ -235,13 +235,38 @@ namespace MWGui
|
|
|
|
|
draw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadingScreen::draw()
|
|
|
|
|
bool LoadingScreen::needToDrawLoadingScreen()
|
|
|
|
|
{
|
|
|
|
|
if (mTimer.time_m() > mLastRenderTime + (1.0/mTargetFrameRate) * 1000.0)
|
|
|
|
|
if ( mTimer.time_m() <= mLastRenderTime + (1.0/mTargetFrameRate) * 1000.0)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// the minimal delay before a loading screen shows
|
|
|
|
|
const float initialDelay = 0.05;
|
|
|
|
|
|
|
|
|
|
bool alreadyShown = (mLastRenderTime > mLoadingOnTime);
|
|
|
|
|
float diff = (mTimer.time_m() - mLoadingOnTime);
|
|
|
|
|
|
|
|
|
|
if (!alreadyShown)
|
|
|
|
|
{
|
|
|
|
|
// bump the delay by the current progress - i.e. if during the initial delay the loading
|
|
|
|
|
// has almost finished, no point showing the loading screen now
|
|
|
|
|
diff -= mProgress / static_cast<float>(mProgressBar->getScrollRange()) * 100.f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
|
|
|
|
== MWBase::StateManager::State_NoGame);
|
|
|
|
|
if (!showWallpaper && diff < initialDelay*1000)
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadingScreen::draw()
|
|
|
|
|
{
|
|
|
|
|
if (!needToDrawLoadingScreen())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
bool showWallpaper = (MWBase::Environment::get().getStateManager()->getState()
|
|
|
|
|
== MWBase::StateManager::State_NoGame);
|
|
|
|
|
if (showWallpaper && mTimer.time_m() > mLastWallpaperChangeTime + 5000*1)
|
|
|
|
|
{
|
|
|
|
|
mLastWallpaperChangeTime = mTimer.time_m();
|
|
|
|
@ -269,6 +294,5 @@ namespace MWGui
|
|
|
|
|
|
|
|
|
|
mLastRenderTime = mTimer.time_m();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|