2012-09-11 14:37:54 +00:00
|
|
|
#ifndef MWGUI_LOADINGSCREEN_H
|
|
|
|
#define MWGUI_LOADINGSCREEN_H
|
|
|
|
|
2019-02-25 15:47:42 +00:00
|
|
|
#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
|
|
|
|
2013-04-10 04:32:05 +00:00
|
|
|
#include "windowbase.hpp"
|
2012-09-11 14:37:54 +00:00
|
|
|
|
2013-08-27 13:48:13 +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;
|
|
|
|
}
|
2015-06-07 19:21:57 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
{
|
2014-03-30 21:04:12 +00:00
|
|
|
class BackgroundImage;
|
|
|
|
|
2013-08-27 13:48:13 +00:00
|
|
|
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
|
2018-10-28 07:44:14 +00:00
|
|
|
virtual void setLabel (const std::string& label, bool important, bool center);
|
2017-11-16 21:08:33 +00:00
|
|
|
virtual void loadingOn(bool visible=true);
|
2013-08-27 13:48:13 +00:00
|
|
|
virtual void loadingOff();
|
|
|
|
virtual void setProgressRange (size_t range);
|
|
|
|
virtual void setProgress (size_t value);
|
2014-04-28 09:29:57 +00:00
|
|
|
virtual void increaseProgress (size_t increase=1);
|
2013-08-27 13:48:13 +00:00
|
|
|
|
2014-03-30 21:04:12 +00:00
|
|
|
virtual void setVisible(bool visible);
|
|
|
|
|
2017-08-30 21:26:30 +00:00
|
|
|
double getTargetFrameRate() const;
|
|
|
|
|
2012-09-11 14:37:54 +00:00
|
|
|
private:
|
2015-05-03 14:58:05 +00:00
|
|
|
void findSplashScreens();
|
2015-10-23 14:50:08 +00:00
|
|
|
bool needToDrawLoadingScreen();
|
2015-05-03 14:58:05 +00:00
|
|
|
|
2017-02-03 22:39:39 +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;
|
|
|
|
|
2015-05-03 15:04:21 +00:00
|
|
|
double mLastWallpaperChangeTime;
|
|
|
|
double mLastRenderTime;
|
2015-05-03 14:58:05 +00:00
|
|
|
osg::Timer mTimer;
|
2015-05-03 16:16:54 +00:00
|
|
|
double mLoadingOnTime;
|
2012-09-11 14:37:54 +00:00
|
|
|
|
2015-12-15 20:14:25 +00:00
|
|
|
bool mImportantLabel;
|
|
|
|
|
2017-11-16 21:08:33 +00:00
|
|
|
bool mVisible;
|
|
|
|
|
2013-08-27 13:48:13 +00:00
|
|
|
size_t mProgress;
|
|
|
|
|
2017-02-03 22:39:39 +00:00
|
|
|
bool mShowWallpaper;
|
|
|
|
|
2014-12-19 23:04:24 +00:00
|
|
|
MyGUI::Widget* mLoadingBox;
|
|
|
|
|
2012-09-11 14:37:54 +00:00
|
|
|
MyGUI::TextBox* mLoadingText;
|
2013-08-27 13:48:13 +00:00
|
|
|
MyGUI::ScrollBar* mProgressBar;
|
2014-03-30 21:04:12 +00:00
|
|
|
BackgroundImage* mBackgroundImage;
|
2017-10-04 15:39:19 +00:00
|
|
|
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
|
|
|
|
2015-06-07 19:21:57 +00:00
|
|
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
2017-04-28 15:30:26 +00:00
|
|
|
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
|
2015-06-07 19:21:57 +00:00
|
|
|
|
2012-09-13 10:33:09 +00:00
|
|
|
void changeWallpaper();
|
2013-08-27 13:48:13 +00:00
|
|
|
|
|
|
|
void draw();
|
2012-09-11 14:37:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|