2014-08-10 16:56:54 +02:00
|
|
|
#ifndef OPENMW_MWGUI_SCREENFADER_H
|
|
|
|
#define OPENMW_MWGUI_SCREENFADER_H
|
|
|
|
|
2014-10-05 17:53:50 +02:00
|
|
|
#include <deque>
|
2019-02-25 18:47:42 +03:00
|
|
|
#include <memory>
|
2014-10-05 17:53:50 +02:00
|
|
|
|
2014-08-01 16:25:41 +02:00
|
|
|
#include "windowbase.hpp"
|
|
|
|
|
|
|
|
namespace MWGui
|
|
|
|
{
|
2014-10-05 17:53:50 +02:00
|
|
|
class ScreenFader;
|
|
|
|
|
|
|
|
class FadeOp
|
|
|
|
{
|
|
|
|
public:
|
2017-05-05 21:21:11 +02:00
|
|
|
typedef std::shared_ptr<FadeOp> Ptr;
|
2014-10-05 17:53:50 +02:00
|
|
|
|
2017-09-24 19:15:39 +02:00
|
|
|
FadeOp(ScreenFader * fader, float time, float targetAlpha, float delay);
|
2014-10-05 17:53:50 +02:00
|
|
|
|
|
|
|
bool isRunning();
|
|
|
|
|
|
|
|
void start();
|
|
|
|
void update(float dt);
|
|
|
|
void finish();
|
|
|
|
|
|
|
|
private:
|
|
|
|
ScreenFader * mFader;
|
|
|
|
float mRemainingTime;
|
|
|
|
float mTargetTime;
|
|
|
|
float mTargetAlpha;
|
|
|
|
float mStartAlpha;
|
2017-09-24 19:15:39 +02:00
|
|
|
float mDelay;
|
2014-10-05 17:53:50 +02:00
|
|
|
bool mRunning;
|
|
|
|
};
|
2014-08-01 16:25:41 +02:00
|
|
|
|
|
|
|
class ScreenFader : public WindowBase
|
|
|
|
{
|
|
|
|
public:
|
2015-12-07 18:32:58 +01:00
|
|
|
ScreenFader(const std::string & texturePath, const std::string& layout = "openmw_screen_fader.layout", const MyGUI::FloatCoord& texCoordOverride = MyGUI::FloatCoord(0,0,1,1));
|
2017-10-04 17:26:23 +02:00
|
|
|
~ScreenFader();
|
2014-10-11 23:09:20 +02:00
|
|
|
|
2017-10-04 17:26:23 +02:00
|
|
|
void onFrameStart(float dt);
|
2014-08-01 16:25:41 +02:00
|
|
|
|
2017-09-24 19:15:39 +02:00
|
|
|
void fadeIn(const float time, float delay=0);
|
|
|
|
void fadeOut(const float time, float delay=0);
|
|
|
|
void fadeTo(const int percent, const float time, float delay=0);
|
2014-08-01 16:25:41 +02:00
|
|
|
|
2017-09-23 23:02:17 +02:00
|
|
|
void clear();
|
|
|
|
|
2014-08-01 16:25:41 +02:00
|
|
|
void setFactor (float factor);
|
2014-10-05 17:53:50 +02:00
|
|
|
void setRepeat(bool repeat);
|
2014-08-01 16:25:41 +02:00
|
|
|
|
2017-09-24 19:15:39 +02:00
|
|
|
void queue(float time, float targetAlpha, float delay);
|
2014-10-11 22:21:48 +02:00
|
|
|
bool isEmpty();
|
2014-10-05 17:53:50 +02:00
|
|
|
void clearQueue();
|
2014-08-01 16:25:41 +02:00
|
|
|
|
2014-10-05 17:53:50 +02:00
|
|
|
void notifyAlphaChanged(float alpha);
|
|
|
|
void notifyOperationFinished();
|
|
|
|
float getCurrentAlpha();
|
2014-08-01 16:25:41 +02:00
|
|
|
|
2014-10-05 17:53:50 +02:00
|
|
|
private:
|
|
|
|
void applyAlpha();
|
2014-08-01 16:25:41 +02:00
|
|
|
|
|
|
|
float mCurrentAlpha;
|
|
|
|
float mFactor;
|
|
|
|
|
2014-10-05 17:53:50 +02:00
|
|
|
bool mRepeat; // repeat queued operations without removing them
|
|
|
|
std::deque<FadeOp::Ptr> mQueue;
|
|
|
|
};
|
2014-08-01 16:25:41 +02:00
|
|
|
}
|
2014-08-10 16:56:54 +02:00
|
|
|
|
|
|
|
#endif
|