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

Author Topic: Prevent window repaint  (Read 2110 times)

0 Members and 1 Guest are viewing this topic.

trishtren

  • Newbie
  • *
  • Posts: 1
    • View Profile
Prevent window repaint
« on: May 14, 2011, 12:14:23 pm »
Hey, i just started using SFML from java 2d and im trying to convert some code over.
Im developing a small 2d map layout tool and i dont want the window to refresh itself as it only needs to when an object is moved or dragged etc. Mainly im looking to increase the performance by stopping it repainting every frame.
Does anyone know what function i could call to stop refreshing/repaint?

Fred_FS

  • Newbie
  • *
  • Posts: 48
    • View Profile
Prevent window repaint
« Reply #1 on: May 14, 2011, 12:53:09 pm »
The usual way is to draw the scene again and again.
but if you don't want to, just don't call RenderWindow::Clear() and RenderWindow::Draw().
But you have to implement your own draw-function, which is only called if there is movement in your scene.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Prevent window repaint
« Reply #2 on: May 14, 2011, 03:41:09 pm »
SFML is not made for this. If you want to do "static" drawing you should rather use a pure windowing library and override the paint event.
Laurent Gomila - SFML developer