add a simple Map class and draw it from the Client
This commit is contained in:
1 parent
3eff7d6097
commit
2c7e454ca8
5 files changed
+83
-17
No files matched your search
Executable
+16
@@ -0,0 +1,16 @@
|
||||
|
||||
#include "Map.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
Map::Map(int width, int height)
|
||||
{
|
||||
m_width = width;
|
||||
m_height = height;
|
||||
m_grid = vector< vector< bool > >(height, vector<bool>(width, true));
|
||||
}
|
||||
|
||||
bool Map::tile_present(int x, int y)
|
||||
{
|
||||
return m_grid[y][x];
|
||||
}
|
||||
Executable
+20
@@ -0,0 +1,20 @@
|
||||
|
||||
#ifndef MAP_H
|
||||
#define MAP_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
class Map
|
||||
{
|
||||
public:
|
||||
Map(int width=50, int height=50);
|
||||
bool tile_present(int x, int y);
|
||||
int get_width() { return m_width; }
|
||||
int get_height() { return m_height; }
|
||||
protected:
|
||||
int m_width;
|
||||
int m_height;
|
||||
std::vector< std::vector< bool > > m_grid;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user