dungeon_crawler
view prototype/src/level.h @ 28:f5fb04fe12cd
moved compiler detection to the configure script
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 25 Aug 2012 20:20:56 +0300 |
parents | 252a00508411 |
children | 862461b686f4 |
line source
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
4 #include <vector>
5 #include "vmath/vmath.h"
7 class GridCell;
8 class Tile;
10 class Level {
11 private:
12 // cells are stored as a linear array of pointers to GridCells
13 // null pointers mean unpopulated cells.
14 GridCell **cells;
15 int xsz, ysz;
16 float cell_size;
18 void draw_grid() const;
20 public:
21 Level();
22 ~Level();
24 bool load(const char *fname);
25 bool save(const char *fname) const;
27 const GridCell *get_cell(int x, int y) const;
28 Vector3 get_cell_pos(int x, int y) const;
29 unsigned int get_cell_dirmask(int x, int y) const;
31 void draw() const;
32 void draw_lights() const;
33 };
35 class GridCell {
36 private:
37 // each grid-cell might contain multiple tiles.
38 std::vector<const Tile*> tiles;
40 public:
41 GridCell(const Tile *tile = 0);
43 void add_tile(const Tile *tile);
45 void draw(unsigned int draw_mask) const;
46 void draw_lights(unsigned int draw_mask) const;
47 };
49 #endif // LEVEL_H_