1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/openmw/mwgui/loadingscreen.hpp

101 lines
2.3 KiB
C++
Raw Normal View History

2012-09-11 16:37:54 +02:00
#ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H
#include <memory>
#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
#include "windowbase.hpp"
2012-09-11 16:37:54 +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;
}
namespace osg
{
class Texture2D;
}
namespace Resource
2015-05-03 16:58:05 +02:00
{
class ResourceSystem;
2015-01-10 03:56:06 +01:00
}
2012-09-11 16:37:54 +02:00
namespace MWGui
{
class BackgroundImage;
class CopyFramebufferToTextureCallback;
class LoadingScreen : public WindowBase, public Loading::Listener
2012-09-11 16:37:54 +02:00
{
public:
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
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;
double getTargetFrameRate() const;
2012-09-11 16:37:54 +02:00
private:
2015-05-03 16:58:05 +02:00
void findSplashScreens();
bool needToDrawLoadingScreen();
2015-05-03 16:58:05 +02:00
void setupCopyFramebufferToTextureCallback();
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;
double mLastWallpaperChangeTime;
double mLastRenderTime;
2015-05-03 16:58:05 +02:00
osg::Timer mTimer;
double mLoadingOnTime;
2012-09-11 16:37:54 +02:00
bool mImportantLabel;
bool mVisible;
int mNestedLoadingCount;
size_t mProgress;
bool mShowWallpaper;
float mOldIcoMin = 0.f;
unsigned int mOldIcoMax = 0;
MyGUI::Widget* mLoadingBox;
2012-09-11 16:37:54 +02:00
MyGUI::TextBox* mLoadingText;
MyGUI::ScrollBar* mProgressBar;
BackgroundImage* mBackgroundImage;
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
osg::ref_ptr<osg::Texture2D> mTexture;
osg::ref_ptr<CopyFramebufferToTextureCallback> mCopyFramebufferToTextureCallback;
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
2012-09-13 12:33:09 +02:00
void changeWallpaper();
void draw();
2012-09-11 16:37:54 +02:00
};
}
#endif