SFML community forums

Help => Graphics => Topic started by: Law on July 17, 2015, 12:40:41 pm

Title: Best way to use sf::Image and sf::Text
Post by: Law 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!
Title: Re: Best way to use sf::Image and sf::Text
Post by: G. on July 17, 2015, 12:45:53 pm
Use an sf::RenderTexture (http://www.sfml-dev.org/tutorials/2.3/graphics-draw.php#off-screen-drawing).
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)
Title: Re: Best way to use sf::Image and sf::Text
Post by: Law on July 17, 2015, 01:03:36 pm
Thanks!