dungeon_crawler

view prototype/src/cfg.cc @ 73:67d330038629

ok fixed the dissapearing particle system. Had forgotten to disable TEXTURE_3D after color grading pass
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 21 Oct 2012 02:11:23 +0300
parents d52711f2b9a1
children
line source
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include "cfg.h"
6 Config cfg;
8 Config::Config()
9 {
10 width = 1280;
11 height = 800;
12 stereo = false;
13 sound = true;
14 level_file = "0.level";
15 tileset_file = "default.tileset";
17 rend = Renderer::any;
18 }
20 bool Config::parse_args(int argc, char **argv)
21 {
22 for(int i=1; i<argc; i++) {
23 if(argv[i][0] == '-') {
24 if(strcmp(argv[i], "-s") == 0) {
25 if(sscanf(argv[++i], "%dx%d", &width, &height) != 2) {
26 fprintf(stderr, "-s must be followed by <width>x<height>\n");
27 return false;
28 }
29 } else if(strcmp(argv[i], "-stereo") == 0) {
30 stereo = true;
31 } else if(strcmp(argv[i], "-nosound") == 0) {
32 sound = false;
33 } else if(strcmp(argv[i], "-level") == 0) {
34 level_file = argv[++i];
35 } else if(strcmp(argv[i], "-tileset") == 0) {
36 tileset_file = argv[++i];
37 } else if(strcmp(argv[i], "-renderer") == 0) {
38 if(strcmp(argv[++i], "mrt") == 0) {
39 rend = Renderer::mrt;
40 } else if(strcmp(argv[i], "mp") == 0) {
41 rend = Renderer::multipass;
42 } else if(strcmp(argv[i], "fwd") == 0) {
43 rend = Renderer::fwd;
44 } else {
45 fprintf(stderr, "invalid renderer specified: %s\n", argv[i]);
46 return false;
47 }
48 } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
49 printf("Usage: %s [options]\n", argv[0]);
50 printf(" -s WxH window size (resolution)\n");
51 printf(" -level <file> specify which level file to load\n");
52 printf(" -tileset <file> specify which tileset to use\n");
53 printf(" -renderer <rend> specify which renderer to use\n");
54 printf(" -stereo enable stereoscopic rendering\n");
55 printf(" -nosound disable sound output\n");
56 printf(" -h/-help print usage information and exit\n");
57 printf("\n");
58 printf("Renderers:\n");
59 printf(" mrt - deferred renderer using multiple draw buffers\n");
60 printf(" mp - multipass deferred renderer for each g-buffer\n");
61 printf(" fwd - fallback forward renderer with simplistic lighting\n");
62 exit(0);
64 } else {
65 fprintf(stderr, "unrecognized option: %s\n", argv[i]);
66 return false;
67 }
68 } else {
69 level_file = argv[i];
70 }
71 }
72 return true;
73 }