1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-15 18:49:54 +00:00
openmw-tes3mp/apps/openmw/mwgui/loadingscreen.hpp
elsid 3915e5d2cc
Always center loading screen progress bar by height when there is active message box
To fix all possible situations when active message box overlaps with loading
screen progress.

The only used condition to center loading screen progress by height is
number of message boxes > 0. No need to pass it through interface.
LoadingScreen can check it inside setLabel function.
2021-05-26 23:29:37 +02:00

99 lines
2.3 KiB
C++

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