#define is a preprocessor directive so it shouldn't be a part of any library.
You could also use strings to build your map, eg if 0 is nothing, 1 is a wall, 2 is a door, maybe Z is 'new line' so you can build your map like;
1111Z1001Z1002Z1111
Then you don't have to worry about arrays and whatever, you just make your render map function parse the string.
If you did that I suggest making a map editor program too :P
#include <iostream>
#include "windows.h"
using namespace std;
int height = 7;
void map1()
{
"1111000000000Z1001000000000Z1001000000000Z1001000000000Z1101000000000Z0000000000000Z0000000000000";
}
void drawMap1()
{
for(int i=0; i<height; i++)
{
switch(uhwhatdoIputhere)
{
case '0':
cout << ' ';
break;
case '1':
cout << '#';
break;
case '2':
cout << '/';
break;
case 'Z':
cout << endl;
break;
}
}
}
int main()
{
drawMap1();
}
char map[] = "1111z1001z1001z1111x";
void drawmap() {
int i=0;
for(;;) {
switch(map[i]) {
case '0': cout << ' '; break;
case '1': cout << '#'; break;
case '2': cout << '/'; break;
case 'z': cout << endl; break;
defauilt: break; } } }
Switch is the same as switch i {
case 1: ...
case 2: ...
}
// is the same as
if(i == 1) ...
else if(i ==2) ...
I used an infinite loop and some other random stuff in that top example, but maybe you can get the idea? I'm not great at explaining things :x
int i=0;
for(;;) {
switch(map)[i]
switch(map1[i])
Post getting too big now
Success!
Improved