]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ColorFade.h
switched geometric scalars from floating to fixed
[l2e.git] / src / graphics / ColorFade.h
1 #ifndef GRAPHICS_COLORFADE_H_
2 #define GRAPHICS_COLORFADE_H_
3
4 #include "../app/State.h"
5 #include "../app/Timer.h"
6
7 #include <SDL.h>
8
9 namespace graphics {
10
11 class ColorFade
12 : public app::State {
13
14 public:
15         ColorFade(app::State *slave, Uint32 color, int duration, bool in = false, bool interactive = false);
16         virtual ~ColorFade() { }
17
18 public:
19         void SetLeadInTime(int ms) { leadIn = ms; if (ms > 0) leadInDone = false; }
20         void SetLeadOutTime(int ms) { leadOut = ms; }
21
22 public:
23         virtual void HandleEvents(const app::Input &);
24         virtual void UpdateWorld(Uint32 deltaT);
25         virtual void Render(SDL_Surface *);
26
27 private:
28         virtual void OnEnterState(SDL_Surface *screen);
29         virtual void OnExitState(SDL_Surface *screen);
30         virtual void OnResumeState(SDL_Surface *screen);
31         virtual void OnPauseState(SDL_Surface *screen);
32
33         virtual void OnResize(int width, int height);
34
35 private:
36         void UpdateBlinds(int width, int height);
37         Uint8 GetAlpha() const;
38
39 private:
40         app::Timer<Uint32> timer;
41         app::State *slave;
42         SDL_Surface *blinds;
43         Uint32 color;
44         int duration;
45         int leadIn;
46         int leadOut;
47         bool leadInDone;
48         bool fadeDone;
49         bool in;
50         bool interactive;
51
52 };
53
54 }
55
56 #endif /* GRAPHICS_COLORFADE_H_ */