dbf_amiga

diff src/opt.cc @ 0:87dfe0e10235

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 31 Aug 2015 07:38:37 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/opt.cc	Mon Aug 31 07:38:37 2015 +0300
     1.3 @@ -0,0 +1,31 @@
     1.4 +#include <stdio.h>
     1.5 +#include "opt.h"
     1.6 +
     1.7 +Options opt;
     1.8 +
     1.9 +bool init_options(int argc, char **argv)
    1.10 +{
    1.11 +	opt.xres = 1280;
    1.12 +	opt.yres = 800;
    1.13 +	opt.fullscreen = false;
    1.14 +	opt.shadows = true;
    1.15 +	opt.reflections = true;
    1.16 +
    1.17 +	for(int i=1; i<argc; i++) {
    1.18 +		if(argv[i][0] == '-') {
    1.19 +			if(strcmp(argv[i], "-noshadows") == 0) {
    1.20 +				opt.shadows = false;
    1.21 +			} else if(strcmp(argv[i], "-fullscreen") == 0) {
    1.22 +				opt.fullscreen = true;
    1.23 +			} else {
    1.24 +				fprintf(stderr, "invalid option: %s\n", argv[i]);
    1.25 +				return false;
    1.26 +			}
    1.27 +		} else {
    1.28 +			fprintf(stderr, "unexpected argument: %s\n", argv[i]);
    1.29 +			return false;
    1.30 +		}
    1.31 +	}
    1.32 +
    1.33 +	return true;
    1.34 +}