dungeon_crawler
changeset 25:527fede30057
- fixed sphere rendering (PointLight::draw)
- added config argument options
- fixed macosx compilation
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Aug 2012 02:16:08 +0300 |
parents | e122ba214ee1 |
children | 21999ef6636b |
files | prototype/Makefile prototype/src/cfg.cc prototype/src/cmdcon.cc prototype/src/light.cc prototype/src/main.cc |
diffstat | 5 files changed, 33 insertions(+), 26 deletions(-) [+] |
line diff
1.1 --- a/prototype/Makefile Thu Aug 23 18:03:11 2012 +0300 1.2 +++ b/prototype/Makefile Sat Aug 25 02:16:08 2012 +0300 1.3 @@ -11,10 +11,12 @@ 1.4 inc = -Ivmath -Idrawtext `pkg-config --cflags freetype2` 1.5 1.6 CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(inc) 1.7 -CXXFLAGS = $(CFLAGS) -std=c++11 1.8 -LDFLAGS = $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` 1.9 +CXXFLAGS = $(CFLAGS) -std=c++11 $(add_cxxflags) 1.10 +LDFLAGS = $(add_ldflags) $(libgl) -lm -lassimp -limago `pkg-config --libs freetype2` 1.11 1.12 ifeq ($(shell uname -s), Darwin) 1.13 + add_cxxflags = -stdlib=libc++ 1.14 + add_ldflags = -stdlib=libc++ 1.15 libgl = -framework OpenGL -framework GLUT -lglew 1.16 else 1.17 libgl = -lGL -lGLU -lglut -lGLEW
2.1 --- a/prototype/src/cfg.cc Thu Aug 23 18:03:11 2012 +0300 2.2 +++ b/prototype/src/cfg.cc Sat Aug 25 02:16:08 2012 +0300 2.3 @@ -17,29 +17,33 @@ 2.4 bool Config::parse_args(int argc, char **argv) 2.5 { 2.6 for(int i=1; i<argc; i++) { 2.7 - if(strcmp(argv[i], "-s") == 0) { 2.8 - if(sscanf(argv[++i], "%dx%d", &width, &height) != 2) { 2.9 - fprintf(stderr, "-s must be followed by <width>x<height>\n"); 2.10 + if(argv[i][0] == '-') { 2.11 + if(strcmp(argv[i], "-s") == 0) { 2.12 + if(sscanf(argv[++i], "%dx%d", &width, &height) != 2) { 2.13 + fprintf(stderr, "-s must be followed by <width>x<height>\n"); 2.14 + return false; 2.15 + } 2.16 + } else if(strcmp(argv[i], "-stereo") == 0) { 2.17 + stereo = true; 2.18 + } else if(strcmp(argv[i], "-level") == 0) { 2.19 + level_file = argv[++i]; 2.20 + } else if(strcmp(argv[i], "-tileset") == 0) { 2.21 + tileset_file = argv[++i]; 2.22 + } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { 2.23 + printf("Usage: %s [options]\n", argv[0]); 2.24 + printf(" -s WxH window size (resolution)\n"); 2.25 + printf(" -level <filename> specify which level file to load\n"); 2.26 + printf(" -tileset <filename> specify which tileset to use\n"); 2.27 + printf(" -stereo enable stereoscopic rendering\n"); 2.28 + printf(" -h/-help print usage information and exit\n"); 2.29 + exit(0); 2.30 + 2.31 + } else { 2.32 + fprintf(stderr, "unrecognized option: %s\n", argv[i]); 2.33 return false; 2.34 } 2.35 - } else if(strcmp(argv[i], "-stereo") == 0) { 2.36 - stereo = true; 2.37 - } else if(strcmp(argv[i], "-level") == 0) { 2.38 - level_file = argv[++i]; 2.39 - } else if(strcmp(argv[i], "-tileset") == 0) { 2.40 - tileset_file = argv[++i]; 2.41 - } else if(strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) { 2.42 - printf("Usage: %s [options]\n", argv[0]); 2.43 - printf(" -s WxH window size (resolution)\n"); 2.44 - printf(" -level <filename> specify which level file to load\n"); 2.45 - printf(" -tileset <filename> specify which tileset to use\n"); 2.46 - printf(" -stereo enable stereoscopic rendering\n"); 2.47 - printf(" -h/-help print usage information and exit\n"); 2.48 - exit(0); 2.49 - 2.50 } else { 2.51 - fprintf(stderr, "unrecognized argument: %s\n", argv[i]); 2.52 - return false; 2.53 + level_file = argv[i]; 2.54 } 2.55 } 2.56 return true;
3.1 --- a/prototype/src/cmdcon.cc Thu Aug 23 18:03:11 2012 +0300 3.2 +++ b/prototype/src/cmdcon.cc Sat Aug 25 02:16:08 2012 +0300 3.3 @@ -60,7 +60,7 @@ 3.4 3.5 case '\b': 3.6 if(!cmdline.empty()) { 3.7 - cmdline.erase(cmdline.back()); 3.8 + cmdline.pop_back(); // <-- C++11 3.9 } 3.10 break; 3.11
4.1 --- a/prototype/src/light.cc Thu Aug 23 18:03:11 2012 +0300 4.2 +++ b/prototype/src/light.cc Sat Aug 25 02:16:08 2012 +0300 4.3 @@ -124,9 +124,9 @@ 4.4 float phi = v * M_PI; 4.5 4.6 Vector3 res; 4.7 - res.x = sin(theta) * cos(phi); 4.8 - res.y = sin(theta); 4.9 - res.z = cos(theta) * cos(phi); 4.10 + res.x = sin(theta) * sin(phi); 4.11 + res.y = cos(phi); 4.12 + res.z = cos(theta) * sin(phi); 4.13 return res; 4.14 } 4.15