]> git.localhorst.tv Git - l2e.git/blob - src/graphics/ColorFade.h
added color fading state
[l2e.git] / src / graphics / ColorFade.h
1 /*
2  * ColorFade.h
3  *
4  *  Created on: Oct 7, 2012
5  *      Author: holy
6  */
7
8 #ifndef GRAPHICS_COLORFADE_H_
9 #define GRAPHICS_COLORFADE_H_
10
11 #include "../app/State.h"
12 #include "../app/Timer.h"
13
14 #include <SDL.h>
15
16 namespace graphics {
17
18 class ColorFade
19 : public app::State {
20
21 public:
22         ColorFade(app::State *slave, Uint32 color, int duration, bool in = false, bool interactive = false);
23         virtual ~ColorFade() { }
24
25 public:
26         virtual void EnterState(app::Application &ctrl, SDL_Surface *screen);
27         virtual void ExitState(app::Application &ctrl, SDL_Surface *screen);
28         virtual void ResumeState(app::Application &ctrl, SDL_Surface *screen);
29         virtual void PauseState(app::Application &ctrl, SDL_Surface *screen);
30
31         virtual void Resize(int width, int height);
32
33         virtual void HandleEvents(const app::Input &);
34         virtual void UpdateWorld(float deltaT);
35         virtual void Render(SDL_Surface *);
36
37 private:
38         void UpdateBlinds(int width, int height);
39         Uint8 GetAlpha() const;
40
41 private:
42         app::Timer<Uint32> timer;
43         app::Application *ctrl;
44         app::State *slave;
45         SDL_Surface *blinds;
46         Uint32 color;
47         int duration;
48         bool in;
49         bool interactive;
50
51 };
52
53 }
54
55 #endif /* GRAPHICS_COLORFADE_H_ */