]> git.localhorst.tv Git - blank.git/blob - src/app/Runtime.hpp
configurable asset and save path
[blank.git] / src / app / Runtime.hpp
1 #ifndef BLANK_RUNTIME_HPP_
2 #define BLANK_RUNTIME_HPP_
3
4 #include "../ui/Interface.hpp"
5 #include "../world/World.hpp"
6
7 #include <cstddef>
8 #include <string>
9
10
11 namespace blank {
12
13 /// Parse and interpret arguemnts, then set up the environment and execute.
14 class Runtime {
15
16 public:
17         enum Mode {
18                 /// default behaviour: run until user quits, dynamic timesteps
19                 NORMAL,
20                 /// quit after n frames
21                 FRAME_LIMIT,
22                 /// quit after n milliseconds
23                 TIME_LIMIT,
24                 /// quit after n frames, use fixed timestap
25                 FIXED_FRAME_LIMIT,
26                 /// display error message and quit with failure
27                 ERROR,
28         };
29
30         struct Config {
31                 bool vsync = true;
32                 bool doublebuf = true;
33                 int multisampling = 1;
34
35                 std::string asset_path;
36                 std::string save_path;
37
38                 Interface::Config interface = Interface::Config();
39                 World::Config world = World::Config();
40         };
41
42         Runtime() noexcept;
43
44         void ReadArgs(int argc, const char *const *argv);
45
46         int Execute();
47
48 private:
49         const char *name;
50         Mode mode;
51         std::size_t n;
52         std::size_t t;
53         Config config;
54
55 };
56
57 }
58
59 #endif