1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 23:19:56 +00:00
openmw-tes3mp/apps/openmw/mwgui/loadingscreen.hpp

95 lines
2 KiB
C++
Raw Normal View History

2012-09-11 14:37:54 +00:00
#ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H
#include <memory>
2015-05-03 14:58:05 +00:00
#include <osg/Timer>
#include <osg/ref_ptr>
2012-09-11 14:37:54 +00:00
#include "windowbase.hpp"
2012-09-11 14:37:54 +00:00
#include <components/loadinglistener/loadinglistener.hpp>
2015-05-03 14:58:05 +00:00
namespace osgViewer
2015-01-10 02:56:06 +00:00
{
2015-05-03 14:58:05 +00:00
class Viewer;
}
namespace osg
{
class Texture2D;
}
2015-05-03 14:58:05 +00:00
namespace VFS
{
class Manager;
2015-01-10 02:56:06 +00:00
}
2012-09-11 14:37:54 +00:00
namespace MWGui
{
class BackgroundImage;
class LoadingScreen : public WindowBase, public Loading::Listener
2012-09-11 14:37:54 +00:00
{
public:
2015-05-03 14:58:05 +00:00
LoadingScreen(const VFS::Manager* vfs, osgViewer::Viewer* viewer);
virtual ~LoadingScreen();
2015-12-15 20:03:56 +00:00
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
virtual void setLabel (const std::string& label, bool important, bool center);
virtual void loadingOn(bool visible=true);
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);
double getTargetFrameRate() const;
2012-09-11 14:37:54 +00:00
private:
2015-05-03 14:58:05 +00:00
void findSplashScreens();
bool needToDrawLoadingScreen();
2015-05-03 14:58:05 +00:00
void setupCopyFramebufferToTextureCallback();
2015-05-03 14:58:05 +00:00
const VFS::Manager* mVFS;
osg::ref_ptr<osgViewer::Viewer> mViewer;
2012-09-11 14:37:54 +00:00
2015-05-08 22:02:38 +00:00
double mTargetFrameRate;
double mLastWallpaperChangeTime;
double mLastRenderTime;
2015-05-03 14:58:05 +00:00
osg::Timer mTimer;
double mLoadingOnTime;
2012-09-11 14:37:54 +00:00
bool mImportantLabel;
bool mVisible;
size_t mProgress;
bool mShowWallpaper;
MyGUI::Widget* mLoadingBox;
2012-09-11 14:37:54 +00:00
MyGUI::TextBox* mLoadingText;
MyGUI::ScrollBar* mProgressBar;
BackgroundImage* mBackgroundImage;
BackgroundImage* mSceneImage;
2012-09-11 17:18:26 +00:00
2015-05-03 14:58:05 +00:00
std::vector<std::string> mSplashScreens;
2012-09-11 14:37:54 +00:00
osg::ref_ptr<osg::Texture2D> mTexture;
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
2012-09-13 10:33:09 +00:00
void changeWallpaper();
void draw();
2012-09-11 14:37:54 +00:00
};
}
#endif