This probably sounds really weird but here is what is happening.
I am using SFML along with C++, but I think this problem falls under the C++ category and not the SFML category.
I am using a multi-dimensional vector to hold numerical values that are read from a text file. The different numbers represent different types of terrain on a map (the text file is essentially a map for a game).
I read the numbers from the file and store them in a 2D Vector. The numbers get into the vector in the correct order, but then when I try to print them in the SFML window the map is printed sideways, so I can't get the colors correct on the map.
As you are doing it, you are looping through each i, then printing out the "line".
As stored in the vector, it is as such:
i ->
j7777777
7000007
|7000007
V7770777
7000007
7000007
7777777
Hence when you print it out it is "rotated". If you want to print it the other way, simply switch your i/j in your loops (so you loop over j first, then i) or switch the i/j in the array.
EDIT: Okay I got it to print the correct ASCII values, so the map shape is correct, but the map isn't being colored correctly by the if statement inside of the inner for loop.
1 2 3 4 5 6 7 8 9 10 11 12 13
for (int j = 0; j < rows; j++) {
fgets(Line, 50, Import);
for (int i = 0; i < columns; i++) {
MapArr[i][j] = Line[i];
if (MapArr[i][j] == 48) {
Rect = sf::Shape::Rectangle(i*50, j*50, 50, 50, sf::Color::Green);
//cout << i*50 << " " << j*50 << endl;
DispMapArr.push_back(Rect);
}
cout << MapArr[i][j];
}
cout << "\n";
}