Thank you Snarky, I went with the one sprite per tile approach and I have to say it works perfectly just like you said! I also understand what you meant by 'destructive update'. Once you Draw on the Background it stays forever that way, but I need to Clear it everytime I draw the map anyway so I won't have to restore the background image.
The second part of my test includes other elements like objects and they stack perfectly with transparency and alpha which is great!
Here is the code I'm using, it seems to work fine.
Code: ags
*edit: I added the delete command for the dynamic sprite (the manual mentions it).
Very helpful and clear answer, thanks again!
The second part of my test includes other elements like objects and they stack perfectly with transparency and alpha which is great!
Here is the code I'm using, it seems to work fine.
DynamicSprite *MapViewport = DynamicSprite.Create(Num_Tiles_X * Tiles_Width, Num_Tiles_Y * Tiles_Height, true);
DrawingSurface *MapSurface = MapViewport.GetDrawingSurface();
MapSurface.Clear(COLOR_TRANSPARENT);
for(int i=0; i<Num_Tiles_Y; i++)
{
for(int j=0; j<Num_Tiles_X; j++)
{
MapSurface.DrawImage(j * Tiles_Width, i * Tiles_Height, Tiles_Slot + Tiles_Floor[(i * Num_Tiles_X) + j].Index, 0);
}
}
MapSurface.Release();
DrawingSurface *Background = Room.GetDrawingSurfaceForBackground();
Background.Clear(COLOR_TRANSPARENT); //GUIs cover the extra space outside viewport
Background.DrawImage(0, 0, MapViewport.Graphic);
Background.Release();
MapViewport.Delete();
*edit: I added the delete command for the dynamic sprite (the manual mentions it).
Very helpful and clear answer, thanks again!