conworlds

view src/gameopt.cc @ 20:782ff06817fb

merged ...
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 26 Aug 2014 18:42:53 +0300
parents
children
line source
1 #include <stdio.h>
2 #include <string.h>
3 #include "gameopt.h"
5 GameOption opt;
7 bool parse_args(int argc, char **argv)
8 {
9 int i;
11 for(i=1; i<argc; i++) {
12 if(argv[i][0] == '-') {
13 if(strcmp(argv[i], "-vr") == 0) {
14 opt.vr = true;
16 } else if(strcmp(argv[i], "-vrmodule") == 0) {
17 opt.vr_module = argv[++i];
18 if(strcmp(opt.vr_module, "stereo") == 0) {
19 opt.stereo = true;
20 }
22 } else {
23 fprintf(stderr, "invalid option: %s\n", argv[i]);
24 return false;
25 }
26 } else {
27 fprintf(stderr, "unexpected argument: %s\n", argv[i]);
28 return false;
29 }
30 }
31 return true;
32 }
34 GameOption::GameOption()
35 {
36 vr = false;
37 vr_module = 0;
38 stereo = false;
39 }