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