I'm trying to blt a surface depending on a value in an array, but nothing gets blted. Can anyone let me know whats wrong? Because I can't figure it out for the life of me!
BTW, tile.TileInformation[k][i] is an int
Code:
//tile macros
#define ID_GRASS 1
#define ID_DIRT 2
#define ID_FLOWER 3
...
//generate random terrain data
for(int k = 0;k<25;k++)
{
for(int i = 0; i<19;i++)
{
tile.TileInformation[k][i] = 1;//Random_Range(1,3); //fill our array with random values
}
}
...
for(int y = 0;y<25;y++)
{
for(int x = 0; x<19;x++)
{
switch(tile.TileInformation[x][y])
{
case ID_GRASS:
tile.Grass.dest_rect.left = y*32;
tile.Grass.dest_rect.right = tile.Grass.dest_rect.left + 32;
tile.Grass.dest_rect.top = x*32;
tile.Grass.dest_rect.bottom = tile.Grass.dest_rect.top + 32;
DDback->Blt(&tile.Grass.dest_rect,//destination rectangle(coords)
tile.Grass.DDTile, //our DD surface
&tile.Grass.src_rect,//source RECT
DDBLT_WAIT,NULL); //params
break;
case ID_DIRT:
tile.Dirt.dest_rect.left = y*32;
tile.Dirt.dest_rect.right = tile.Dirt.dest_rect.left + 32;
tile.Dirt.dest_rect.top = x*32;
tile.Dirt.dest_rect.bottom = tile.Dirt.dest_rect.top + 32;
DDback->Blt(&tile.Dirt.dest_rect,//destination rectangle(coords)
tile.Dirt.DDTile, //our DD surface
&tile.Dirt.src_rect,//source RECT
DDBLT_WAIT,NULL); //params
break;
case ID_FLOWER:
tile.Flower.dest_rect.left = y*32;
tile.Flower.dest_rect.right = tile.Flower.dest_rect.left + 32;
tile.Flower.dest_rect.top = x*32;
tile.Flower.dest_rect.bottom = tile.Flower.dest_rect.top + 32;
DDback->Blt(&tile.Flower.dest_rect,//destination rectangle(coords)
tile.Flower.DDTile, //our DD surface
&tile.Flower.src_rect,//source RECT
DDBLT_WAIT,NULL); //params
break;
}
}
}