]> git.localhorst.tv Git - gworm.git/blob - src/app/Application.h
speed up rendering by caching world texture
[gworm.git] / src / app / Application.h
1 #ifndef GWORM_APPLICATION_H_
2 #define GWORM_APPLICATION_H_
3
4 #include "../graphics/Camera.h"
5 #include "../graphics/Moveable.h"
6 #include "../graphics/Texture.h"
7 #include "../graphics/Vector.h"
8
9 #include <SDL.h>
10
11
12 namespace gworm {
13
14 class Canvas;
15 class World;
16
17 class Application {
18
19 public:
20         Application(Canvas &, World &);
21
22 public:
23         void Run();
24
25 private:
26         void Loop(int delta_ms);
27
28         void HandleEvents();
29         void OnKeyDown(const SDL_KeyboardEvent &);
30         void OnKeyUp(const SDL_KeyboardEvent &);
31
32         void Update(int delta_ms);
33
34         void Render();
35         void RenderBackground();
36         void RenderWorld();
37         void RenderEntities();
38         void RenderUI();
39
40 private:
41         Canvas &canvas;
42         World &world;
43
44         Texture worldTex;
45
46         Moveable<float> focus;
47         Camera cam;
48
49         Uint32 last;
50         bool running;
51         bool paused;
52
53 };
54
55 }
56
57 #endif