dungeon_crawler

view prototype/src/level.h @ 38:862461b686f4

start work on particle systems
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 29 Aug 2012 03:22:36 +0300
parents fa8f89d06f6f
children 38e16366efc2
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 // secondary data structure, simple list of all populated cells
19 std::vector<GridCell*> cell_list;
21 void draw_grid() const;
23 public:
24 Level();
25 ~Level();
27 bool load(const char *fname);
28 bool save(const char *fname) const;
30 const GridCell *get_cell(int x, int y) const;
31 Vector3 get_cell_pos(int x, int y) const;
32 unsigned int get_cell_dirmask(int x, int y) const;
34 void update(unsigned long msec, float dt);
36 void draw() const;
37 void draw_lights() const;
38 };
40 class GridCell {
41 private:
42 // each grid-cell might contain multiple tiles.
43 std::vector<Tile*> tiles;
45 public:
46 GridCell(Tile *tile = 0);
48 void add_tile(Tile *tile);
50 void update(unsigned long msec, float dt);
52 void draw(unsigned int draw_mask) const;
53 void draw_lights(unsigned int draw_mask) const;
54 };
56 #endif // LEVEL_H_