Erm, this is basically the method I'm using.
It loads in a map from an array (hence the post I made on the main C++ forum). It then basically runs the array through this mass case/switch/for katamar:
Code:
int genMap()
{
int xp = 0;
int yp = 0;
for(int x=0; x<10; x++)
{
for(int y=0; y<10; y++)
{
switch(map[x][y])
{
case 'W':
drawImg(water_tile00, xp, yp);
break;
case 'M':
drawImg(mount_tile00, xp, yp);
break;
case 'G':
drawImg(grass_tile00, xp, yp);
break;
}
if(xp == 288)
{
xp = 0;
break;
}
else
{
xp = xp + 32;
}
}
yp = yp + 32;
}
return 0;
}
Just wondering if this'll get slow with bigger maps with more than three tiles. It looks like it probably will. My other method involved creating an array of SDL_Surfaces too, for some reason. No idea why. That'd add a lot more code. Array is what I want when I create a tile class, I assume (at which point, I can just hardcode in tile data, and have an array of tile pointers point to the tiles, I assume? [MY GOD REDUNDANT {Redundancy is actually my god}]).
Anyway, currently working on cleaning up source code (and adding classes proper). Maybe something'll come to me in the process.
(Also, I know I should be using tilesets and classes to handle tiles. This is more proof of concept for myself).