summary refs log tree commit diff stats
path: root/src/map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp17
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