Basically what I need to do is copy a whole bunch of small rects from Image B to Image A. I'm currently using Image::copy() to do it, it works but it is oh so very slow, so I'm hoping someone could show me a faster way to do it then what I have?
If so thank you so much.
tileset and tmp are both sf::Image
for (; y < ey; y++)
{
sx = -(ScrollX & (TileSize - 1)) + (2 * TileSize);
//x = ScrollX & (TileSize - 1);
x = ScrollX / TileSize;
ex = x + (ScreenWidth / TileSize) - 4;
//pc = &(BG[ (ScrollX / TileSize) ][y]);
for (; x < ex; x++)
{
tile = MainLayer[y][x] & 0xFF;
if (tile)
{
//MessageBox(0, "non-zero tile!", "blah", 0);
r.Left = (tile & 15) * TileSize;
r.Top = (tile / 16) * TileSize;
r.Width = r.Left + TileSize;
r.Height = r.Top + TileSize;
if(!(sx<0 || sy<0))
tmp.Copy(tileset,sx,sy,r,1);
}
sx += TileSize;
}
sy += TileSize;
}