24 void Runtime::ReadArgs(int argc, const char *const *argv) {
25 if (argc <= 0) return;
31 for (int i = 1; i < argc; ++i) {
32 const char *arg = argv[i];
33 if (!arg || arg[0] == '\0') {
34 cerr << "warning: found empty argument at position " << i << endl;
37 if (options && arg[0] == '-') {
39 cerr << "warning: incomplete option list at position " << i << endl;
40 } else if (arg[1] == '-') {
46 if (strcmp(arg + 2, "no-vsync") == 0) {
48 } else if (strcmp(arg + 2, "no-keyboard") == 0) {
49 config.interface.keyboard_disabled = true;
50 } else if (strcmp(arg + 2, "no-mouse") == 0) {
51 config.interface.mouse_disabled = true;
52 } else if (strcmp(arg + 2, "no-hud") == 0) {
53 config.interface.visual_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;
114 } else if (isdigit(arg[0])) {
115 // positional number interpreted as -n
116 n = strtoul(arg, nullptr, 10);
118 cerr << "unable to interpret argument "
119 << i << " (" << arg << ")" << endl;
131 mode = FIXED_FRAME_LIMIT;
142 int Runtime::Execute() {
147 Application app(config);
159 case FIXED_FRAME_LIMIT: