]> git.localhorst.tv Git - l2e.git/blob - src/app/Application.h
added Input class for handling user input
[l2e.git] / src / app / Application.h
1 /*
2  * Application.h
3  *
4  *  Created on: Apr 8, 2012
5  *      Author: holy
6  */
7
8 #ifndef APP_APPLICATION_H_
9 #define APP_APPLICATION_H_
10
11 #include "Input.h"
12 #include "../sdl/InitScreen.h"
13
14 #include <stack>
15 #include <SDL.h>
16
17
18 namespace app {
19
20 class State;
21
22 class Application {
23
24 public:
25         Application(sdl::InitScreen *screen, State *initialState);
26         ~Application(void);
27 private:
28         Application(const Application &);
29         Application &operator =(const Application &);
30
31 public:
32         void Run(void);
33         void Loop(void);
34
35 public:
36         void ChangeState(State *);
37         void PushState(State *);
38         void PopState(void);
39         void Quit(void);
40         Input &Buttons() { return input; }
41         const Input &Buttons() const { return input; }
42
43 private:
44         State *CurrentState(void);
45         void RealPushState(State *);
46         void RealPopState(void);
47         void PopAllStates(void);
48
49 private:
50         void HandleEvents(void);
51         void UpdateWorld(Uint32 deltaT);
52         void Render(void);
53
54 private:
55         sdl::InitScreen *screen;
56         std::stack<State *> states;
57         Input input;
58         Uint32 last;
59
60 };
61
62 }
63
64 #endif /* APP_APPLICATION_H_ */