void drawMap(std::string MapLoc) {
char* gridMap[95] [55];
ifstream Map(MapLoc, ifstream::in, ifstream::binary);
while (Map.good())
{
for(int i = 0; i < 95; i++)
{
for(int j = 0; j < 55; j++)
{
if (gridMap[i] [j] == "X")
{
//Draw Wall
glColor4ub(255,255,255,255);
glBegin(GL_QUADS);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glEnd();
}
else if (gridMap[i] [j] == ".")
{
//Draw Space
glColor4ub(0,0,0,255);
glBegin(GL_QUADS);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glVertex2f(10*i,10*j);
glEnd();
}
else if (gridMap[i] [j] == "C")
{
//Draw Char
}
else if (gridMap[i] [j] == "O")
{
//Draw Opponent
}
}
}
}
Map.close();
}
I need to read characters from a text file into a 2D array then compare them to draw accordingly, OpenGL and SDL used.
Please use and edit my code to reply with solution if possible.