dungeon_crawler

view prototype/src/level.h @ 14:67ae9fcb802c

loading normal map
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 19 Aug 2012 06:30:18 +0300
parents 96de911d05d4
children fa8f89d06f6f
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;
30 void draw() const;
31 };
33 class GridCell {
34 private:
35 // each grid-cell might contain multiple tiles.
36 std::vector<const Tile*> tiles;
38 public:
39 GridCell(const Tile *tile = 0);
41 void add_tile(const Tile *tile);
43 void draw(unsigned int draw_mask) const;
44 };
46 #endif // LEVEL_H_