2012-09-11 16:37:54 +02:00
|
|
|
#ifndef MWGUI_LOADINGSCREEN_H
|
|
|
|
#define MWGUI_LOADINGSCREEN_H
|
|
|
|
|
2019-02-25 18:47:42 +03:00
|
|
|
#include <memory>
|
|
|
|
|
2020-12-17 22:51:04 +00:00
|
|
|
#include <osg/Camera>
|
2015-05-03 16:58:05 +02:00
|
|
|
#include <osg/Timer>
|
|
|
|
#include <osg/ref_ptr>
|
2012-09-11 16:37:54 +02:00
|
|
|
|
2013-04-10 00:32:05 -04:00
|
|
|
#include "windowbase.hpp"
|
2012-09-11 16:37:54 +02:00
|
|
|
|
2013-08-27 15:48:13 +02:00
|
|
|
#include <components/loadinglistener/loadinglistener.hpp>
|
|
|
|
|
2015-05-03 16:58:05 +02:00
|
|
|
namespace osgViewer
|
2015-01-10 03:56:06 +01:00
|
|
|
{
|
2015-05-03 16:58:05 +02:00
|
|
|
class Viewer;
|
|
|
|
}
|
2015-06-07 21:21:57 +02:00
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Texture2D;
|
|
|
|
}
|
|
|
|
|
2020-05-05 13:37:00 +00:00
|
|
|
namespace Resource
|
2015-05-03 16:58:05 +02:00
|
|
|
{
|
2020-05-05 13:37:00 +00:00
|
|
|
class ResourceSystem;
|
2015-01-10 03:56:06 +01:00
|
|
|
}
|
|
|
|
|
2012-09-11 16:37:54 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
2014-03-30 23:04:12 +02:00
|
|
|
class BackgroundImage;
|
2020-12-16 21:46:52 +01:00
|
|
|
class CopyFramebufferToTextureCallback;
|
2014-03-30 23:04:12 +02:00
|
|
|
|
2013-08-27 15:48:13 +02:00
|
|
|
class LoadingScreen : public WindowBase, public Loading::Listener
|
2012-09-11 16:37:54 +02:00
|
|
|
{
|
|
|
|
public:
|
2020-05-05 13:37:00 +00:00
|
|
|
LoadingScreen(Resource::ResourceSystem* resourceSystem, osgViewer::Viewer* viewer);
|
2015-05-03 16:58:05 +02:00
|
|
|
virtual ~LoadingScreen();
|
|
|
|
|
2015-12-15 21:03:56 +01:00
|
|
|
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
|
2020-10-16 22:18:54 +04:00
|
|
|
void setLabel (const std::string& label, bool important, bool center) override;
|
|
|
|
void loadingOn(bool visible=true) override;
|
|
|
|
void loadingOff() override;
|
|
|
|
void setProgressRange (size_t range) override;
|
|
|
|
void setProgress (size_t value) override;
|
|
|
|
void increaseProgress (size_t increase=1) override;
|
|
|
|
|
|
|
|
void setVisible(bool visible) override;
|
2014-03-30 23:04:12 +02:00
|
|
|
|
2017-08-30 21:26:30 +00:00
|
|
|
double getTargetFrameRate() const;
|
|
|
|
|
2012-09-11 16:37:54 +02:00
|
|
|
private:
|
2015-05-03 16:58:05 +02:00
|
|
|
void findSplashScreens();
|
2015-10-23 16:50:08 +02:00
|
|
|
bool needToDrawLoadingScreen();
|
2015-05-03 16:58:05 +02:00
|
|
|
|
2017-02-03 23:39:39 +01:00
|
|
|
void setupCopyFramebufferToTextureCallback();
|
|
|
|
|
2020-05-05 13:37:00 +00:00
|
|
|
Resource::ResourceSystem* mResourceSystem;
|
2015-05-03 16:58:05 +02:00
|
|
|
osg::ref_ptr<osgViewer::Viewer> mViewer;
|
2012-09-11 16:37:54 +02:00
|
|
|
|
2015-05-09 00:02:38 +02:00
|
|
|
double mTargetFrameRate;
|
|
|
|
|
2015-05-03 17:04:21 +02:00
|
|
|
double mLastWallpaperChangeTime;
|
|
|
|
double mLastRenderTime;
|
2015-05-03 16:58:05 +02:00
|
|
|
osg::Timer mTimer;
|
2015-05-03 18:16:54 +02:00
|
|
|
double mLoadingOnTime;
|
2012-09-11 16:37:54 +02:00
|
|
|
|
2015-12-15 21:14:25 +01:00
|
|
|
bool mImportantLabel;
|
|
|
|
|
2017-11-16 22:08:33 +01:00
|
|
|
bool mVisible;
|
2020-06-18 13:23:39 +02:00
|
|
|
int mNestedLoadingCount;
|
2017-11-16 22:08:33 +01:00
|
|
|
|
2013-08-27 15:48:13 +02:00
|
|
|
size_t mProgress;
|
|
|
|
|
2017-02-03 23:39:39 +01:00
|
|
|
bool mShowWallpaper;
|
2020-05-05 13:37:00 +00:00
|
|
|
float mOldIcoMin = 0.f;
|
|
|
|
unsigned int mOldIcoMax = 0;
|
2017-02-03 23:39:39 +01:00
|
|
|
|
2014-12-20 00:04:24 +01:00
|
|
|
MyGUI::Widget* mLoadingBox;
|
|
|
|
|
2012-09-11 16:37:54 +02:00
|
|
|
MyGUI::TextBox* mLoadingText;
|
2013-08-27 15:48:13 +02:00
|
|
|
MyGUI::ScrollBar* mProgressBar;
|
2014-03-30 23:04:12 +02:00
|
|
|
BackgroundImage* mBackgroundImage;
|
2017-10-04 17:39:19 +02:00
|
|
|
BackgroundImage* mSceneImage;
|
2012-09-11 19:18:26 +02:00
|
|
|
|
2015-05-03 16:58:05 +02:00
|
|
|
std::vector<std::string> mSplashScreens;
|
2012-09-11 16:37:54 +02:00
|
|
|
|
2015-06-07 21:21:57 +02:00
|
|
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
2020-12-16 21:46:52 +01:00
|
|
|
osg::ref_ptr<CopyFramebufferToTextureCallback> mCopyFramebufferToTextureCallback;
|
2017-04-28 17:30:26 +02:00
|
|
|
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
|
2015-06-07 21:21:57 +02:00
|
|
|
|
2012-09-13 12:33:09 +02:00
|
|
|
void changeWallpaper();
|
2013-08-27 15:48:13 +02:00
|
|
|
|
|
|
|
void draw();
|
2012-09-11 16:37:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|