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;
53 cerr << "unknown option " << arg << endl;
59 for (int j = 1; arg[j] != '\0'; ++j) {
62 config.doublebuf = false;
66 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
67 cerr << "missing argument to -m" << endl;
70 config.multisampling = strtoul(argv[i], nullptr, 10);
75 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
76 cerr << "missing argument to -n" << endl;
79 n = strtoul(argv[i], nullptr, 10);
84 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
85 cerr << "missing argument to -s" << endl;
88 config.world.gen.solid_seed = strtoul(argv[i], nullptr, 10);
89 config.world.gen.type_seed = config.world.gen.solid_seed;
94 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
95 cerr << "missing argument to -t" << endl;
98 t = strtoul(argv[i], nullptr, 10);
106 cerr << "unknown option " << arg[j] << endl;
112 } else if (isdigit(arg[0])) {
113 // positional number interpreted as -n
114 n = strtoul(arg, nullptr, 10);
116 cerr << "unable to interpret argument "
117 << i << " (" << arg << ")" << endl;
129 mode = FIXED_FRAME_LIMIT;
140 int Runtime::Execute() {
145 Application app(config);
157 case FIXED_FRAME_LIMIT: