dungeon_crawler

diff prototype/src/level.h @ 1:96de911d05d4

started a rough prototype
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 28 Jun 2012 06:05:50 +0300
parents
children 252a00508411
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/prototype/src/level.h	Thu Jun 28 06:05:50 2012 +0300
     1.3 @@ -0,0 +1,44 @@
     1.4 +#ifndef LEVEL_H_
     1.5 +#define LEVEL_H_
     1.6 +
     1.7 +#include <vector>
     1.8 +#include "vmath/vmath.h"
     1.9 +
    1.10 +class GridCell;
    1.11 +class Tile;
    1.12 +
    1.13 +class Level {
    1.14 +private:
    1.15 +	// cells are stored as a linear array of pointers to GridCells
    1.16 +	// null pointers mean unpopulated cells.
    1.17 +	GridCell **cells;
    1.18 +	int xsz, ysz;
    1.19 +	float cell_size;
    1.20 +
    1.21 +	void draw_grid() const;
    1.22 +
    1.23 +public:
    1.24 +	Level();
    1.25 +	~Level();
    1.26 +
    1.27 +	bool load(const char *fname);
    1.28 +	bool save(const char *fname) const;
    1.29 +
    1.30 +	const GridCell *get_cell(int x, int y) const;
    1.31 +	Vector3 get_cell_pos(int x, int y) const;
    1.32 +
    1.33 +	void draw() const;
    1.34 +};
    1.35 +
    1.36 +class GridCell {
    1.37 +private:
    1.38 +	// each grid-cell might contain multiple tiles.
    1.39 +	std::vector<const Tile*> tiles;
    1.40 +
    1.41 +public:
    1.42 +	void add_tile(const Tile *tile);
    1.43 +
    1.44 +	void draw() const;
    1.45 +};
    1.46 +
    1.47 +#endif	// LEVEL_H_