dungeon_crawler

view prototype/src/level.h @ 47:d52711f2b9a1

started writting audio code
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 16 Sep 2012 08:16:50 +0300
parents 38e16366efc2
children aa9e28670ae2
line source
1 #ifndef LEVEL_H_
2 #define LEVEL_H_
4 #include <vector>
5 #include "vmath/vmath.h"
6 #include "psys/psys.h"
8 class GridCell;
9 class Tile;
11 class Level {
12 private:
13 // cells are stored as a linear array of pointers to GridCells
14 // null pointers mean unpopulated cells.
15 GridCell **cells;
16 int xsz, ysz;
17 float cell_size;
19 // secondary data structure, simple list of all populated cells
20 std::vector<GridCell*> cell_list;
22 void draw_grid() const;
24 public:
25 Level();
26 ~Level();
28 bool load(const char *fname);
29 bool save(const char *fname) const;
31 const GridCell *get_cell(int x, int y) const;
32 Vector3 get_cell_pos(int x, int y) const;
33 unsigned int get_cell_dirmask(int x, int y) const;
35 void update(unsigned long msec, float dt);
37 void draw() const;
38 void draw_lights() const;
39 void draw_post() const;
40 };
42 class GridCell {
43 private:
44 // each grid-cell might contain multiple tiles.
45 std::vector<Tile*> tiles;
47 // particle systems
48 std::vector<struct psys_emitter*> psys;
50 public:
51 GridCell(Tile *tile = 0);
53 void add_tile(Tile *tile);
55 void update(unsigned long msec, float dt);
57 void draw(unsigned int draw_mask) const;
58 void draw_lights(unsigned int draw_mask) const;
59 void draw_post(unsigned int draw_mask) const;
60 };
62 #endif // LEVEL_H_