12 Runtime::Runtime() noexcept
22 void Runtime::ReadArgs(int argc, const char *const *argv) {
23 if (argc <= 0) return;
29 for (int i = 1; i < argc; ++i) {
30 const char *arg = argv[i];
31 if (!arg || arg[0] == '\0') {
32 cerr << "warning: found empty argument at position " << i << endl;
35 if (options && arg[0] == '-') {
37 cerr << "warning: incomplete option list at position " << i << endl;
38 } else if (arg[1] == '-') {
44 if (strcmp(arg + 2, "no-vsync") == 0) {
46 } else if (strcmp(arg + 2, "no-keyboard") == 0) {
47 config.interface.keyboard_disabled = true;
48 } else if (strcmp(arg + 2, "no-mouse") == 0) {
49 config.interface.mouse_disabled = true;
50 } else if (strcmp(arg + 2, "no-hud") == 0) {
51 config.interface.visual_disabled = true;
52 } else if (strcmp(arg + 2, "no-audio") == 0) {
53 config.interface.audio_disabled = true;
55 cerr << "unknown option " << arg << endl;
61 for (int j = 1; arg[j] != '\0'; ++j) {
64 config.doublebuf = false;
68 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
69 cerr << "missing argument to -m" << endl;
72 config.multisampling = strtoul(argv[i], nullptr, 10);
77 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
78 cerr << "missing argument to -n" << endl;
81 n = strtoul(argv[i], nullptr, 10);
86 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
87 cerr << "missing argument to -s" << endl;
90 config.world.gen.solid_seed = strtoul(argv[i], nullptr, 10);
91 config.world.gen.type_seed = config.world.gen.solid_seed;
96 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
97 cerr << "missing argument to -t" << endl;
100 t = strtoul(argv[i], nullptr, 10);
108 cerr << "unknown option " << arg[j] << endl;
115 cerr << "unable to interpret argument "
116 << i << " (" << arg << ")" << endl;
128 mode = FIXED_FRAME_LIMIT;
139 int Runtime::Execute() {
144 Application app(config);
156 case FIXED_FRAME_LIMIT: