14 Runtime::Runtime() noexcept
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;
54 } else if (strcmp(arg + 2, "no-audio") == 0) {
55 config.interface.audio_disabled = true;
57 cerr << "unknown option " << arg << endl;
63 for (int j = 1; arg[j] != '\0'; ++j) {
66 config.doublebuf = false;
70 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
71 cerr << "missing argument to -m" << endl;
74 config.multisampling = strtoul(argv[i], nullptr, 10);
79 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
80 cerr << "missing argument to -n" << endl;
83 n = strtoul(argv[i], nullptr, 10);
88 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
89 cerr << "missing argument to -s" << endl;
92 config.world.gen.solid_seed = strtoul(argv[i], nullptr, 10);
93 config.world.gen.type_seed = config.world.gen.solid_seed;
98 if (i >= argc || argv[i] == nullptr || argv[i][0] == '\0') {
99 cerr << "missing argument to -t" << endl;
102 t = strtoul(argv[i], nullptr, 10);
110 cerr << "unknown option " << arg[j] << endl;
117 cerr << "unable to interpret argument "
118 << i << " (" << arg << ")" << endl;
130 mode = FIXED_FRAME_LIMIT;
141 int Runtime::Execute() {
146 Init init(config.doublebuf, config.multisampling);
147 Application app(init.window, config);
159 case FIXED_FRAME_LIMIT: