actual progress bar, performance optimization

actorid
scrawl 12 years ago
parent 2b339f6c0f
commit 369db182de

@ -17,6 +17,7 @@ namespace MWGui
, mLastRenderTime(0.f)
{
getWidget(mLoadingText, "LoadingText");
getWidget(mProgressBar, "ProgressBar");
}
LoadingScreen::~LoadingScreen()
@ -50,10 +51,10 @@ namespace MWGui
float refProgress;
if (mTotalRefsLoading <= 1)
refProgress = 0;
refProgress = 1;
else
refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1);
std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoading-1 << std::endl;
float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading);
assert(progress <= 1 && progress >= 0);
if (progress >= 1)
@ -62,11 +63,12 @@ namespace MWGui
return;
}
mLoadingText->setCaption(stage + "... " + Ogre::StringConverter::toString(progress));
mLoadingText->setCaption(stage + "... ");
mProgressBar->setProgressPosition (static_cast<size_t>(progress * 1000));
static float loadingScreenFps = 40.f;
static float loadingScreenFps = 30.f;
//if (mTimer.getMilliseconds () > mLastRenderTime + (1.f/loadingScreenFps) * 1000.f)
if (mTimer.getMilliseconds () > mLastRenderTime + (1.f/loadingScreenFps) * 1000.f)
{
mLastRenderTime = mTimer.getMilliseconds ();

@ -25,6 +25,7 @@ namespace MWGui
Ogre::Timer mTimer;
MyGUI::TextBox* mLoadingText;
MyGUI::ProgressBar* mProgressBar;
int mCurrentCellLoading;
int mTotalCellsLoading;

@ -6,8 +6,11 @@
<Widget type="Widget" skin="HUD_Box" position="0 200 300 80" align="Bottom HCenter">
<Widget type="AutoSizedTextBox" skin="SandText" position="30 35 240 24" name="LoadingText">
<Property key="Caption" value="Asdf"/>
<Widget type="AutoSizedTextBox" skin="SandText" position="30 20 240 24" name="LoadingText">
</Widget>
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="30 50 240 24" name="ProgressBar">
<Property key="Range" value="1000"/>
</Widget>
</Widget>

Loading…
Cancel
Save