Hello,
Try draw (for…) you tile once, before loop. By example, I draw my tile in sf::Image object (buffer). When my surface is complete, I join sf::Image (with draw tile) to sf::Sprite object and draw this in loop.
By Example:
sf::Image Buffer(640,640);
...
for (int i=0;i<10;i++)
{
for (int j=0;j<10;j++)
{
TileMap[i][j].SetTileContainer(&TileSet); //My tileset TileMap[i][j].SetPosition(
i*(float)TileMap[i][j].GetTileContainer()->GetTileWidth(0),
j*(float)TileMap[i][j].GetTileContainer()->GetTileHeight(0)); TileMap[i][j].SetTile(tab_mapa[j][i]);
Buffer.Copy(
*TileMap[i][j].GetImage()
,(int)TileMap[i][j].GetPosition().x
,(int)TileMap[i][j].GetPosition().y
,TileMap[i][j].GetSubRect()
);
}
}
sf::Sprite Map_01;//Sprite part #1
sf::Sprite Map_02;//Sprite part #2
sf::Sprite Map_03;//Sprite part #3
sf::Sprite Map_04;//Sprite part #4
Map_01.SetImage(Buffer);
Map_01.SetPosition(0.0f,0.0f);
Map_02.SetImage(Buffer);
Map_02.SetPosition(640.0f,0.0f);
Map_03.SetImage(Buffer);
Map_03.SetPosition(0.0f,640.0f);
Map_04.SetImage(Buffer);
Map_04.SetPosition(640.0f,640.0f);
And in Loop…
...
App.Clear(sf::Color(255,255,255));
App.Draw(Map_01);
App.Draw(Map_02);
App.Draw(Map_03);
App.Draw(Map_04);
...
Next, I use sf::View to move “background”. This solution is only example, test…
I use SFML 1.5
Jack Flower