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