You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw-tes3mp/apps/openmw/mwgui/loadingscreen.hpp

100 lines
2.3 KiB
C++

12 years ago
#ifndef MWGUI_LOADINGSCREEN_H
#define MWGUI_LOADINGSCREEN_H
#include <memory>
#include <osg/Timer>
#include <osg/ref_ptr>
12 years ago
#include "windowbase.hpp"
12 years ago
#include <components/loadinglistener/loadinglistener.hpp>
namespace osgViewer
{
class Viewer;
}
namespace osg
{
class Texture2D;
}
namespace Resource
{
class ResourceSystem;
}
12 years ago
namespace MWGui
{
class BackgroundImage;
class CopyFramebufferToTextureCallback;
class LoadingScreen : public WindowBase, public Loading::Listener
12 years ago
{
public:
LoadingScreen(Resource::ResourceSystem* resourceSystem, osgViewer::Viewer* viewer);
virtual ~LoadingScreen();
/// Overridden from Loading::Listener, see the Loading::Listener documentation for usage details
void setLabel (const std::string& label, bool important) 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;
12 years ago
private:
void findSplashScreens();
bool needToDrawLoadingScreen();
void setupCopyFramebufferToTextureCallback();
Resource::ResourceSystem* mResourceSystem;
osg::ref_ptr<osgViewer::Viewer> mViewer;
12 years ago
double mTargetFrameRate;
double mLastWallpaperChangeTime;
double mLastRenderTime;
osg::Timer mTimer;
double mLoadingOnTime;
12 years ago
bool mImportantLabel;
bool mVisible;
int mNestedLoadingCount;
size_t mProgress;
bool mShowWallpaper;
float mOldIcoMin = 0.f;
unsigned int mOldIcoMax = 0;
MyGUI::Widget* mLoadingBox;
12 years ago
MyGUI::TextBox* mLoadingText;
MyGUI::ScrollBar* mProgressBar;
BackgroundImage* mBackgroundImage;
BackgroundImage* mSceneImage;
12 years ago
std::vector<std::string> mSplashScreens;
12 years ago
osg::ref_ptr<osg::Texture2D> mTexture;
osg::ref_ptr<CopyFramebufferToTextureCallback> mCopyFramebufferToTextureCallback;
std::unique_ptr<MyGUI::ITexture> mGuiTexture;
void changeWallpaper();
void draw();
12 years ago
};
}
#endif