X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2FRuntime.hpp;h=10a0e55cb559365366c29c090c2dc29bfb67778f;hb=43820582217f7e4b707d98f2e69d969eb77fc7c3;hp=2fdf2e5b0ba2880db1af94f2da8d9560d9db52c8;hpb=b7d09e1e35ef90282c97509e0020b20db3c7ea9f;p=blank.git diff --git a/src/app/Runtime.hpp b/src/app/Runtime.hpp index 2fdf2e5..10a0e55 100644 --- a/src/app/Runtime.hpp +++ b/src/app/Runtime.hpp @@ -1,36 +1,75 @@ #ifndef BLANK_RUNTIME_HPP_ #define BLANK_RUNTIME_HPP_ -#include "Application.hpp" +#include "Environment.hpp" +#include "../net/Client.hpp" +#include "../net/Server.hpp" +#include "../ui/Interface.hpp" +#include "../world/World.hpp" #include +#include namespace blank { +class HeadlessApplication; + +/// Parse and interpret arguemnts, then set up the environment and execute. class Runtime { public: enum Mode { + /// default behaviour: run until user quits, dynamic timesteps NORMAL, + /// quit after n frames FRAME_LIMIT, + /// quit after n milliseconds TIME_LIMIT, + /// quit after n frames, use fixed timestap FIXED_FRAME_LIMIT, + /// display error message and quit with failure ERROR, }; + enum Target { + STANDALONE, + SERVER, + CLIENT, + }; + + struct Config { + bool vsync = true; + bool doublebuf = true; + int multisampling = 1; + + Client::Config client = Client::Config(); + HeadlessEnvironment::Config env = HeadlessEnvironment::Config(); + Interface::Config interface = Interface::Config(); + Server::Config server = Server::Config(); + World::Config world = World::Config(); + }; + Runtime() noexcept; void ReadArgs(int argc, const char *const *argv); int Execute(); +private: + void RunStandalone(); + void RunServer(); + void RunClient(); + + void Run(HeadlessApplication &); + private: const char *name; Mode mode; + Target target; std::size_t n; std::size_t t; - Application::Config config; + Config config; };