OpenMW
apps/openmw/mwgui/loadingscreen.hpp
Go to the documentation of this file.
00001 #ifndef MWGUI_LOADINGSCREEN_H
00002 #define MWGUI_LOADINGSCREEN_H
00003 
00004 #include <OgreSceneManager.h>
00005 
00006 #include "windowbase.hpp"
00007 
00008 #include <components/loadinglistener/loadinglistener.hpp>
00009 
00010 namespace MWGui
00011 {
00012     class LoadingScreen : public WindowBase, public Loading::Listener
00013     {
00014     public:
00015         virtual void setLabel (const std::string& label);
00016 
00018         virtual void indicateProgress ();
00019 
00020         virtual void loadingOn();
00021         virtual void loadingOff();
00022 
00023         virtual void setProgressRange (size_t range);
00024         virtual void setProgress (size_t value);
00025         virtual void increaseProgress (size_t increase);
00026 
00027         virtual void removeWallpaper();
00028 
00029         LoadingScreen(Ogre::SceneManager* sceneMgr, Ogre::RenderWindow* rw);
00030         virtual ~LoadingScreen();
00031 
00032         void setLoadingProgress (const std::string& stage, int depth, int current, int total);
00033         void loadingDone();
00034 
00035         void onResChange(int w, int h);
00036 
00037         void updateWindow(Ogre::RenderWindow* rw) { mWindow = rw; }
00038 
00039     private:
00040         bool mFirstLoad;
00041 
00042         Ogre::SceneManager* mSceneMgr;
00043         Ogre::RenderWindow* mWindow;
00044 
00045         unsigned long mLastWallpaperChangeTime;
00046         unsigned long mLastRenderTime;
00047         Ogre::Timer mTimer;
00048 
00049         size_t mProgress;
00050 
00051         MyGUI::TextBox* mLoadingText;
00052         MyGUI::ScrollBar* mProgressBar;
00053         MyGUI::ImageBox* mBackgroundImage;
00054 
00055         Ogre::Rectangle2D* mRectangle;
00056         Ogre::MaterialPtr mBackgroundMaterial;
00057 
00058         Ogre::StringVector mResources;
00059 
00060         bool mVSyncWasEnabled;
00061 
00062         void changeWallpaper();
00063 
00064         void draw();
00065     };
00066 
00067 }
00068 
00069 
00070 #endif