]> git.localhorst.tv Git - l2e.git/blob - src/app/State.h
added forwarding headers
[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 "fwd.h"
12 #include "Timer.h"
13
14 #include <SDL.h>
15
16 namespace app {
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 HandleEvents(const Input &) = 0;
40         virtual void UpdateWorld(float deltaT) = 0;
41         virtual void Render(SDL_Surface *) = 0;
42
43 public:
44         Timers<Uint32> &GraphicsTimers() { return graphicsTimers; }
45         Timers<float> &PhysicsTimers() { return physicsTimers; }
46
47 private:
48         Timers<Uint32> graphicsTimers;
49         Timers<float> physicsTimers;
50
51 };
52
53 }
54
55 #endif /* APP_STATE_H_ */