terom@358: #ifndef APPLICATION_HH terom@358: #define APPLIATION_HH terom@358: terom@358: #include "Engine.hh" terom@358: #include "Error.hh" terom@358: terom@358: #include terom@358: #include terom@358: terom@358: class ArgumentError : public Error { terom@358: public: terom@358: ArgumentError (const std::string &message) : Error(message) { } terom@358: }; terom@358: terom@358: /** terom@358: * Our CL_ClanApplication. Provides our main function, handles argument parsing and interacts with Engine terom@358: */ terom@358: class Main : public CL_ClanApplication { terom@358: private: terom@358: // arguments terom@358: CL_CommandLine args; terom@358: terom@358: /** terom@358: * --graphics terom@358: */ terom@409: bool graphics_enabled; terom@409: terom@409: /** terom@409: * --fullscreen and --resolution terom@409: */ terom@417: DisplayConfig display; terom@409: terom@409: /** terom@409: * --terrain-seed and --terrain-size terom@409: */ terom@409: TerrainConfig terrain; terom@358: terom@358: /** terom@418: * --log-level terom@418: */ terom@418: EngineConfig engine; terom@418: terom@418: /** terom@358: * --port terom@358: */ terom@409: std::string net_port; terom@358: terom@358: /** terom@358: * --server terom@358: */ terom@409: bool net_server; terom@358: terom@358: /** terom@358: * --connect terom@358: */ terom@409: std::string net_connect; terom@409: terom@409: terom@389: /** terom@389: * Set the arg_* members terom@389: * terom@389: * @return true if execution should proceed, false if execution should stop terom@389: */ terom@389: bool parse_args (int argc, char **argv); terom@389: terom@389: /** terom@409: * Parse signed integer argument terom@389: */ terom@409: int parse_arg_int (const std::string &arg_val, const char *arg_name); terom@409: terom@409: /** terom@409: * Parse unsigned WIDTHxHEIGHT argument terom@409: */ terom@411: PixelDimensions parse_arg_dimensions (const std::string &arg_val, const char *arg_name); terom@418: terom@418: /** terom@418: * Parse a LogLevel terom@418: */ terom@418: LogLevel parse_arg_loglevel (const std::string &arg_val, const char *arg_name); terom@358: terom@358: /** terom@389: * Print out a list of display modes terom@358: */ terom@389: void dump_display_modes (void); terom@397: terom@397: /** terom@417: * Print out our project version and some configuration info terom@397: */ terom@397: void dump_version (void); terom@358: terom@358: public: terom@358: /** terom@409: * Setup default values terom@409: */ terom@409: Main (void); terom@409: terom@409: /** terom@358: * IT BEGAN IN AFRIKA terom@358: */ terom@358: virtual int main (int argc, char **argv); terom@358: } app; terom@358: terom@358: #endif