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

Author Topic: How to save a display ?  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

Elfayer

  • Newbie
  • *
  • Posts: 42
    • View Profile
How to save a display ?
« 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 :

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 ?
« Last Edit: April 22, 2013, 01:39:39 pm by Elfayer »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: How to save a display ?
« Reply #1 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. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Elfayer

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: How to save a display ?
« Reply #2 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 ! =)

 

anything