conworlds
diff src/gameopt.cc @ 13:283cdfa7dda2
added a crapload of code from goat3dgfx
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sun, 24 Aug 2014 09:41:24 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/gameopt.cc Sun Aug 24 09:41:24 2014 +0300 1.3 @@ -0,0 +1,39 @@ 1.4 +#include <stdio.h> 1.5 +#include <string.h> 1.6 +#include "gameopt.h" 1.7 + 1.8 +GameOption opt; 1.9 + 1.10 +bool parse_args(int argc, char **argv) 1.11 +{ 1.12 + int i; 1.13 + 1.14 + for(i=1; i<argc; i++) { 1.15 + if(argv[i][0] == '-') { 1.16 + if(strcmp(argv[i], "-vr") == 0) { 1.17 + opt.vr = true; 1.18 + 1.19 + } else if(strcmp(argv[i], "-vrmodule") == 0) { 1.20 + opt.vr_module = argv[++i]; 1.21 + if(strcmp(opt.vr_module, "stereo") == 0) { 1.22 + opt.stereo = true; 1.23 + } 1.24 + 1.25 + } else { 1.26 + fprintf(stderr, "invalid option: %s\n", argv[i]); 1.27 + return false; 1.28 + } 1.29 + } else { 1.30 + fprintf(stderr, "unexpected argument: %s\n", argv[i]); 1.31 + return false; 1.32 + } 1.33 + } 1.34 + return true; 1.35 +} 1.36 + 1.37 +GameOption::GameOption() 1.38 +{ 1.39 + vr = false; 1.40 + vr_module = 0; 1.41 + stereo = false; 1.42 +}