diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-14 17:57:23 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2015-02-14 17:57:23 -0500 |
commit | 297c093d398e7d6e5fcc5dc6ba1056ede25abf6f (patch) | |
tree | 1e55ab169d6de9a6f11b4d3b6efbe9f1b4d6ab6f /src/map.cpp | |
parent | de5a458cb037bb8e1e80c849c5e6525f9413b43a (diff) | |
download | therapy-297c093d398e7d6e5fcc5dc6ba1056ede25abf6f.tar.gz therapy-297c093d398e7d6e5fcc5dc6ba1056ede25abf6f.tar.bz2 therapy-297c093d398e7d6e5fcc5dc6ba1056ede25abf6f.zip |
Did some lighting and added room name
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/map.cpp b/src/map.cpp index 10cd313..0dd3e04 100644 --- a/src/map.cpp +++ b/src/map.cpp | |||
@@ -21,9 +21,9 @@ Map::Map() | |||
21 | add_collision(GAME_WIDTH+6, 0, GAME_WIDTH, right, 1); | 21 | add_collision(GAME_WIDTH+6, 0, GAME_WIDTH, right, 1); |
22 | 22 | ||
23 | FILE* f = fopen("../maps/bigmap.txt", "r"); | 23 | FILE* f = fopen("../maps/bigmap.txt", "r"); |
24 | char* mapbuf = (char*) malloc(MAP_WIDTH*MAP_HEIGHT*sizeof(char)); | 24 | char* mapbuf = (char*) malloc(MAP_WIDTH*(MAP_HEIGHT-1)*sizeof(char)); |
25 | 25 | ||
26 | for (int i=0; i<MAP_HEIGHT; i++) | 26 | for (int i=0; i<MAP_HEIGHT-1; i++) |
27 | { | 27 | { |
28 | fread(mapbuf + i*MAP_WIDTH, sizeof(char), MAP_WIDTH, f); | 28 | fread(mapbuf + i*MAP_WIDTH, sizeof(char), MAP_WIDTH, f); |
29 | fgetc(f); | 29 | fgetc(f); |
@@ -35,7 +35,7 @@ Map::Map() | |||
35 | bg = createTexture(GAME_WIDTH, GAME_HEIGHT); | 35 | bg = createTexture(GAME_WIDTH, GAME_HEIGHT); |
36 | fillTexture(bg, NULL, 0, 0, 0); | 36 | fillTexture(bg, NULL, 0, 0, 0); |
37 | 37 | ||
38 | for (int i=0; i<MAP_WIDTH*MAP_HEIGHT; i++) | 38 | for (int i=0; i<MAP_WIDTH*(MAP_HEIGHT-1); i++) |
39 | { | 39 | { |
40 | int x = i % MAP_WIDTH; | 40 | int x = i % MAP_WIDTH; |
41 | int y = i / MAP_WIDTH; | 41 | int y = i / MAP_WIDTH; |
@@ -78,6 +78,17 @@ Map::Map() | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | Texture* font = loadTextureFromBMP("../res/font.bmp"); | ||
82 | const char* map_name = "Everything Is Embarassing"; | ||
83 | int start_x = (40/2) - (strlen(map_name)/2); | ||
84 | for (int i=0; i<strlen(map_name); i++) | ||
85 | { | ||
86 | Rectangle srcRect(map_name[i] % 16 * 8, map_name[i] / 16 * 8, 8, 8); | ||
87 | Rectangle dstRect((start_x + i)*8, 24*8, 8, 8); | ||
88 | blitTexture(font, bg, &srcRect, &dstRect); | ||
89 | } | ||
90 | |||
91 | destroyTexture(font); | ||
81 | //destroyTexture(tiles); | 92 | //destroyTexture(tiles); |
82 | } | 93 | } |
83 | 94 | ||