Original Post
Currently, I'm writing a tile engine for platformers. In the old version, I had the maps hard coded into a header file. In my current version, I want the maps to be loaded from a text file into an array. I have a working function for loading the maps into memory, now I need to know how to store them in an array so that I can draw the tiles. I read a method on another forum but it didn't work, so I'll post my code so people can identify the problem: The problem is that it's just not drawing anything on the screen. I have a feeling that it's not reading the file the way it should. I appreciate any help that I can get. Thanks, -KG_Brad
int render_map()
{
int rval = 0;
for (map.i=0;map.i<5;++map.i)
{
for(map.t=0;map.t<5;++map.t)
{
rval = fgetc(mapfile);
MapArray[map.i][map.t] = rval;
if (MapArray[map.i][map.t] == 0) putpixel(screen,map.i,map.t,WHITE);
}
}
}