From 6b99c7aee539e35b8e67520f36adeca9007641cb Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 17 Feb 2015 13:28:50 -0500 Subject: Refactored map loader and added a second map Also tweaked the font for apostrophe, p, and q --- src/map.h | 57 ++++++++++++++++++--------------------------------------- 1 file changed, 18 insertions(+), 39 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index 7986e0d..3c09238 100644 --- a/src/map.h +++ b/src/map.h @@ -1,42 +1,21 @@ -#include -#include -#include "mob.h" -#include "renderer.h" +#ifndef MAP_H +#define MAP_H -using namespace::std; - -const int TILE_WIDTH = 8; -const int TILE_HEIGHT = 8; -const int GAME_WIDTH = 320; -const int GAME_HEIGHT = 200; -const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH; -const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT; - -enum direction_t { - up, left, down, right +class Map { + public: + Map(char* filename); + ~Map(); + const char* mapdata(); + const char* title(); + Map* getLeftMap(); + Map* getRightMap(); + void setLeftMap(Map* m); + void setRightMap(Map* m); + private: + char* m_mapdata; + char* m_title; + Map* m_leftMap = 0; + Map* m_rightMap = 0; }; -typedef struct { - int axis; - int lower; - int upper; - int type; -} collision_t; - -class Map { -public: - Map(); - ~Map(); - void render(Texture* buffer); - void check_collisions(mob_t* mob, int x_next, int y_next); - -private: - void add_collision(int axis, int lower, int upper, direction_t dir, int type); - - list left_collisions; - list right_collisions; - list up_collisions; - list down_collisions; - - Texture* bg; -}; \ No newline at end of file +#endif -- cgit 1.4.1