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