diff options
Diffstat (limited to 'src/map.h')
| -rw-r--r-- | src/map.h | 57 |
1 files changed, 18 insertions, 39 deletions
| 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 @@ | |||
| 1 | #include <list> | 1 | #ifndef MAP_H |
| 2 | #include <vector> | 2 | #define MAP_H |
| 3 | #include "mob.h" | ||
| 4 | #include "renderer.h" | ||
| 5 | 3 | ||
| 6 | using namespace::std; | 4 | class Map { |
| 7 | 5 | public: | |
| 8 | const int TILE_WIDTH = 8; | 6 | Map(char* filename); |
| 9 | const int TILE_HEIGHT = 8; | 7 | ~Map(); |
| 10 | const int GAME_WIDTH = 320; | 8 | const char* mapdata(); |
| 11 | const int GAME_HEIGHT = 200; | 9 | const char* title(); |
| 12 | const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH; | 10 | Map* getLeftMap(); |
| 13 | const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT; | 11 | Map* getRightMap(); |
| 14 | 12 | void setLeftMap(Map* m); | |
| 15 | enum direction_t { | 13 | void setRightMap(Map* m); |
| 16 | up, left, down, right | 14 | private: |
| 15 | char* m_mapdata; | ||
| 16 | char* m_title; | ||
| 17 | Map* m_leftMap = 0; | ||
| 18 | Map* m_rightMap = 0; | ||
| 17 | }; | 19 | }; |
| 18 | 20 | ||
| 19 | typedef struct { | 21 | #endif |
| 20 | int axis; | ||
| 21 | int lower; | ||
| 22 | int upper; | ||
| 23 | int type; | ||
| 24 | } collision_t; | ||
| 25 | |||
| 26 | class Map { | ||
| 27 | public: | ||
| 28 | Map(); | ||
| 29 | ~Map(); | ||
| 30 | void render(Texture* buffer); | ||
| 31 | void check_collisions(mob_t* mob, int x_next, int y_next); | ||
| 32 | |||
| 33 | private: | ||
| 34 | void add_collision(int axis, int lower, int upper, direction_t dir, int type); | ||
| 35 | |||
| 36 | list<collision_t> left_collisions; | ||
| 37 | list<collision_t> right_collisions; | ||
| 38 | list<collision_t> up_collisions; | ||
| 39 | list<collision_t> down_collisions; | ||
| 40 | |||
| 41 | Texture* bg; | ||
| 42 | }; \ No newline at end of file | ||
