For some reason the top line of tiles gets completely messed up somewhere but the rest is file.
I have zipped up the whole project and it is compiled for Windows and Linux. You can download it here.
The main areas that could effect this are:
int displayData()
{
for(int y = 0; y < 6; y++)
{
for(int x = 0; x < 6; x++)
{
switch(data[x][y])
{
case 0:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 0, 255, 0, 255);
break;
case 1:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 0, 0, 255, 255);
break;
case 2:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 0, 0, 0, 255);
break;
case 3:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 200, 200, 200, 255);
break;
case 4:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 255, 0, 255, 255);
break;
case 5:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 255, 0, 0, 255);
break;
default:
boxRGBA(screen, x * 50, y * 50, x * 50 + 50, y * 50 + 50, 255, 255, 255, 255);
break;
}
}
}
return 0;
}// Open the file
file.open("./data.dat");
// Read the file into the data array
for(int y = 0; y < 6; y++)
{
for(int x = 0; x < 6; x++)
{
file >> data[x][y];
}
}
// Display the data
displayData();
...Any help will be great, thanks, Wolfy87.

Help




Back to top








