-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMapUtils.h
55 lines (46 loc) · 1.31 KB
/
MapUtils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef MAPUTILS_H
#define MAPUTILS_H
class MapUtils
{
public:
vector<vector<char> >gameMap;
MapUtils();
void makeMap(int size){
gameMap.reserve(size);
int height = size;
int width = height;
for(int i=0; i < height; i++){
vector<char>x;
width = height * 2;
x.reserve(width);
for(int k = 0; k < x.capacity(); k++){
x.push_back(' ');
}
gameMap.push_back(x);
}
}
void makeWall(int xpos, int ypos, int width, int height){
for(int i = 0; i < height; i++){
for(int k = 0; k < width; k++){
char wallsym;
if(height > width){
wallsym = '|';
} else {
wallsym = '-';
}
gameMap[ypos + i][xpos + k] = wallsym;
}
}
}
void drawMap(){
for(int i=0; i < gameMap.size(); i++){
for(int k=0; k < y[i].size(); k++){
cout << gameMap[i][k];
}
cout << endl;
}
}
protected:
private:
};
#endif // MAPUTILS_H