Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Jack Flower

Pages: [1]
1
Graphics / Displaying sf::String from a pointer
« on: May 17, 2010, 04:37:28 pm »
After installing 1.6 version all is ok.
This solution is correct. I test in my code.

2
Graphics / Re: Tiling a sprite
« on: November 15, 2009, 12:56:02 pm »
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:

Code: [Select]
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

Pages: [1]