1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/apps/openmw/mwgui/loadingscreen.hpp
scrawl 27a05027f4 Fixes #1172: Added basic loading/saving progress bar
The progress is not particularly accurate. It simply uses the current / total number of records written/read as indication. Cell records are currently the largest by far, but there is a good chance that could be optimized using a change tracking system.
2014-04-28 11:29:57 +02:00

73 lines
1.7 KiB
C++

#ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H
#include <OgreSceneManager.h>
#include <OgreTimer.h>
#include "windowbase.hpp"
#include <components/loadinglistener/loadinglistener.hpp>
namespace MWGui
{
class BackgroundImage;
class LoadingScreen : public WindowBase, public Loading::Listener
{
public:
virtual void setLabel (const std::string& label);
/// Indicate that some progress has been made, without specifying how much
virtual void indicateProgress ();
virtual void loadingOn();
virtual void loadingOff();
virtual void setProgressRange (size_t range);
virtual void setProgress (size_t value);
virtual void increaseProgress (size_t increase=1);
virtual void setVisible(bool visible);
virtual void removeWallpaper();
LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw);
virtual ~LoadingScreen();
void setLoadingProgress (const std::string& stage, int depth, int current, int total);
void loadingDone();
void onResChange(int w, int h);
void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
private:
bool mFirstLoad;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;
unsigned long mLastWallpaperChangeTime;
unsigned long mLastRenderTime;
Ogre::Timer mTimer;
size_t mProgress;
MyGUI::TextBox* mLoadingText;
MyGUI::ScrollBar* mProgressBar;
BackgroundImage* mBackgroundImage;
Ogre::StringVector mResources;
bool mVSyncWasEnabled;
void changeWallpaper();
void draw();
};
}
#endif