summary refs log tree commit diff stats
path: root/src/map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/map.h b/src/map.h new file mode 100644 index 0000000..7986e0d --- /dev/null +++ b/src/map.h
@@ -0,0 +1,42 @@
1#include <list>
2#include <vector>
3#include "mob.h"
4#include "renderer.h"
5
6using namespace::std;
7
8const int TILE_WIDTH = 8;
9const int TILE_HEIGHT = 8;
10const int GAME_WIDTH = 320;
11const int GAME_HEIGHT = 200;
12const int MAP_WIDTH = GAME_WIDTH/TILE_WIDTH;
13const int MAP_HEIGHT = GAME_HEIGHT/TILE_HEIGHT;
14
15enum direction_t {
16 up, left, down, right
17};
18
19typedef struct {
20 int axis;
21 int lower;
22 int upper;
23 int type;
24} collision_t;
25
26class Map {
27public:
28 Map();
29 ~Map();
30 void render(Texture* buffer);
31 void check_collisions(mob_t* mob, int x_next, int y_next);
32
33private:
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