SFML community forums

Help => General => Topic started by: Elfayer on April 22, 2013, 01:38:05 pm

Title: How to save a display ?
Post by: Elfayer on April 22, 2013, 01:38:05 pm
Hi,
I have a project in which I have to draw a graphic. So I have to calculate the positions and then draw it. I would like the user to be able to display in a small rectangle the position of the point he is pointing with his mouse. That is already done.
The thing is that I have this result :
(http://img15.hostingpics.net/thumbs/mini_160979Screenshotfrom20130422131101.png) (http://www.hostingpics.net/viewer.php?id=160979Screenshotfrom20130422131101.png)
I would like to save the display I have from the graphic to display it instantly and not recalculate everything every time. And of course let only one box at a time displayed.
How can I do that ?
Title: AW: How to save a display ?
Post by: eXpl0it3r on April 22, 2013, 01:53:10 pm
Recalculating things is essentially not bad, so it's okay to do it as long as you dob't have performance issues. Otherwise you can draw to sf::RenderTexture (SFML 2), .getTexture and draw it with a sprite.

If you don't boxes to show up, then don't draw them. In any case you'll hace to call clear() every frame iteration. :)
Title: Re: How to save a display ?
Post by: Elfayer on April 22, 2013, 02:59:23 pm
Ok, I thought that recalculate every time would have use a lot of process, but finally it works perfectly ! =)