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