| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- /*
- * CFadeAnimation.h, part of VCMI engine
- *
- * Authors: listed in file AUTHORS in main folder
- *
- * License: GNU General Public License v2.0 or later
- * Full text of license available in license.txt file, in main folder
- *
- */
- #pragma once
- #ifdef IN
- #undef IN
- #endif
- #ifdef OUT
- #undef OUT
- #endif
- VCMI_LIB_NAMESPACE_BEGIN
- class Point;
- VCMI_LIB_NAMESPACE_END
- struct SDL_Surface;
- const float DEFAULT_DELTA = 0.05f;
- class CFadeAnimation
- {
- public:
- enum class EMode
- {
- NONE, IN, OUT
- };
- private:
- float delta;
- SDL_Surface * fadingSurface;
- bool fading;
- float fadingCounter;
- bool shouldFreeSurface;
- float initialCounter() const;
- bool isFinished() const;
- public:
- EMode fadingMode;
- CFadeAnimation();
- ~CFadeAnimation();
- void init(EMode mode, SDL_Surface * sourceSurface, bool freeSurfaceAtEnd = false, float animDelta = DEFAULT_DELTA);
- void update();
- void draw(SDL_Surface * targetSurface, const Point & targetPoint);
- bool isFading() const { return fading; }
- };
|