for (int j = 0; j < rows; j++) { //Sorts through the map vector to assign the correct values to it from the text file.
fgets(Line, 50, Import);
for (int i = 0; i < columns; i++) {
MapArr[i][j] = Line[i];
if (MapArr[i][j] == 48) { // If the current vector position contains the number '0', create a green rectangle at that spot on the map and put it in a vector.
Rect = sf::Shape::Rectangle(i*50, j*50, 50, 50, sf::Color::Green);
DispMapArr.push_back(Rect);
}
cout << MapArr[i][j]; // Displays the theoretical map.
}
cout << "\n";
}
You show two different patterns up there, which says something got read in wrong.
I don't know is what is the definition of MapArr.
1 2 3 4 5 6 7
//I assume maparr
char MapArr[50] [50]; // or something similar
MapArr[i][j] = line[i];
// should be, should change the orientation of the output map.
MapArr[j][i] = line[i];
If I wanted to figure this out I would dump the line I read in, to make sure it came in right. The other thing I would make sure of is was accounting for other text features in the file, since I am reading it in as binary and looping with an index.
The orientation is already correct though. I have a little blue square set to move on the 0's (or 48 in ASCII). It moves perfectly on the right tiles.
The only problem is that the program isn't printing the green tiles in the right place. The green tiles are supposed to print on the 0's, but they are printing in a little square in the corner as the illustration in my first post shows. There are no values there to make them be there. It's really weird.