]> git.localhorst.tv Git - l2e.git/blob - src/app/State.h
reworked Application's state stack
[l2e.git] / src / app / State.h
1 /*
2  * State.h
3  *
4  *  Created on: Apr 8, 2012
5  *      Author: holy
6  */
7
8 #ifndef APP_APPLICATIONSTATE_H_
9 #define APP_APPLICATIONSTATE_H_
10
11 #include <SDL.h>
12
13 namespace app {
14
15 class Application;
16 class Input;
17
18 class State {
19
20 public:
21         virtual ~State() { };
22
23 public:
24         /// do some setup
25         /// called when the state first enters the stack
26         /// @param ctrl the Application running the state
27         virtual void EnterState(Application &ctrl, SDL_Surface *screen) = 0;
28         /// do some cleanup
29         /// called when the state is popped from the stack
30         virtual void ExitState(Application &ctrl, SDL_Surface *screen) = 0;
31         /// called when the state becomes the active one
32         virtual void ResumeState(Application &ctrl, SDL_Surface *screen) = 0;
33         /// called when the state becomes inactive
34         virtual void PauseState(Application &ctrl, SDL_Surface *screen) = 0;
35
36         /// adapt the state's graphics to given dimensions
37         virtual void Resize(int width, int height) = 0;
38
39         virtual void HandleInput(const Input &) = 0;
40         virtual void UpdateWorld(float deltaT) = 0;
41         virtual void Render(SDL_Surface *) = 0;
42
43 };
44
45 }
46
47 #endif /* APP_STATE_H_ */