]> git.localhorst.tv Git - blank.git/blob - src/app/Application.hpp
some cleaning :)
[blank.git] / src / app / Application.hpp
1 #ifndef BLANK_APP_APPLICATION_HPP_
2 #define BLANK_APP_APPLICATION_HPP_
3
4 #include "init.hpp"
5 #include "RandomWalk.hpp"
6 #include "../graphics/BlockLighting.hpp"
7 #include "../graphics/Camera.hpp"
8 #include "../graphics/DirectionalLighting.hpp"
9 #include "../ui/Interface.hpp"
10 #include "../world/World.hpp"
11
12
13 namespace blank {
14
15 class Application {
16
17 public:
18         struct Config {
19                 bool vsync = true;
20                 bool doublebuf = true;
21                 int multisampling = 1;
22
23                 Interface::Config interface = Interface::Config();
24                 World::Config world = World::Config();
25         };
26
27         explicit Application(const Config &);
28
29         Application(const Application &) = delete;
30         Application &operator =(const Application &) = delete;
31
32         /// run until user quits
33         void Run();
34         /// evaluate a single frame of dt milliseconds
35         void Loop(int dt);
36
37         /// run for n frames
38         void RunN(size_t n);
39         /// run for t milliseconds
40         void RunT(size_t t);
41         /// run for n frames, assuming t milliseconds for each
42         void RunS(size_t n, size_t t);
43
44         /// process all events in SDL's queue
45         void HandleEvents();
46         /// integrate to the next step with dt milliseconds passed
47         void Update(int dt);
48         /// push the current state to display
49         void Render();
50
51         static Entity &MakeTestEntity(World &);
52
53 private:
54         InitSDL init_sdl;
55         InitIMG init_img;
56         InitGL init_gl;
57         Window window;
58         GLContext ctx;
59         InitGLEW init_glew;
60         BlockLighting chunk_prog;
61         DirectionalLighting entity_prog;
62
63         Camera cam;
64         World world;
65         Interface interface;
66
67         RandomWalk test_controller;
68
69         bool running;
70
71 };
72
73 }
74
75 #endif