mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-07-22 04:14:04 +00:00
actual progress bar, performance optimization
This commit is contained in:
parent
2b339f6c0f
commit
369db182de
3 changed files with 13 additions and 7 deletions
|
@ -17,6 +17,7 @@ namespace MWGui
|
||||||
, mLastRenderTime(0.f)
|
, mLastRenderTime(0.f)
|
||||||
{
|
{
|
||||||
getWidget(mLoadingText, "LoadingText");
|
getWidget(mLoadingText, "LoadingText");
|
||||||
|
getWidget(mProgressBar, "ProgressBar");
|
||||||
}
|
}
|
||||||
|
|
||||||
LoadingScreen::~LoadingScreen()
|
LoadingScreen::~LoadingScreen()
|
||||||
|
@ -50,10 +51,10 @@ namespace MWGui
|
||||||
|
|
||||||
float refProgress;
|
float refProgress;
|
||||||
if (mTotalRefsLoading <= 1)
|
if (mTotalRefsLoading <= 1)
|
||||||
refProgress = 0;
|
refProgress = 1;
|
||||||
else
|
else
|
||||||
refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1);
|
refProgress = float(mCurrentRefLoading) / float(mTotalRefsLoading-1);
|
||||||
|
std::cout << refProgress << " (" << mCurrentRefLoading << ", " << mTotalRefsLoading-1 << std::endl;
|
||||||
float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading);
|
float progress = (float(mCurrentCellLoading)+refProgress) / float(mTotalCellsLoading);
|
||||||
assert(progress <= 1 && progress >= 0);
|
assert(progress <= 1 && progress >= 0);
|
||||||
if (progress >= 1)
|
if (progress >= 1)
|
||||||
|
@ -62,11 +63,12 @@ namespace MWGui
|
||||||
return;
|
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 ();
|
mLastRenderTime = mTimer.getMilliseconds ();
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace MWGui
|
||||||
Ogre::Timer mTimer;
|
Ogre::Timer mTimer;
|
||||||
|
|
||||||
MyGUI::TextBox* mLoadingText;
|
MyGUI::TextBox* mLoadingText;
|
||||||
|
MyGUI::ProgressBar* mProgressBar;
|
||||||
|
|
||||||
int mCurrentCellLoading;
|
int mCurrentCellLoading;
|
||||||
int mTotalCellsLoading;
|
int mTotalCellsLoading;
|
||||||
|
|
|
@ -6,8 +6,11 @@
|
||||||
|
|
||||||
<Widget type="Widget" skin="HUD_Box" position="0 200 300 80" align="Bottom HCenter">
|
<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">
|
<Widget type="AutoSizedTextBox" skin="SandText" position="30 20 240 24" name="LoadingText">
|
||||||
<Property key="Caption" value="Asdf"/>
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="ProgressBar" skin="MW_Progress_Blue" position="30 50 240 24" name="ProgressBar">
|
||||||
|
<Property key="Range" value="1000"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Reference in a new issue