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

Author Topic: Best way to use sf::Image and sf::Text  (Read 1489 times)

0 Members and 1 Guest are viewing this topic.

Law

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Best way to use sf::Image and sf::Text
« on: July 17, 2015, 12:40:41 pm »
Hey,

I'm writing a code that would use several .png files to build an sf::Image from scratch, and at some point I have to add texts on that image. It is my understanding that there's no straightforward way for this, so I was going to actually draw the sf::Sprite then the sf::Text on my sf::RenderWindow, then use the sf::RenderWindow::capture function to get the final image with text on it.

Is this the best way though? I was under the impression that the capture function takes time, and I was hoping to find something more convenient.

Thanks!

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Best way to use sf::Image and sf::Text
« Reply #1 on: July 17, 2015, 12:45:53 pm »
Use an sf::RenderTexture.
It's like drawing on a window, but on a texture. (And you can get its sf::Image afterwards, if that's really what you want)
« Last Edit: July 17, 2015, 12:48:38 pm by G. »

Law

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Best way to use sf::Image and sf::Text
« Reply #2 on: July 17, 2015, 01:03:36 pm »
Thanks!