SFML community forums

Help => Window => Topic started by: trishtren on May 14, 2011, 12:14:23 pm

Title: Prevent window repaint
Post by: trishtren 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?
Title: Prevent window repaint
Post by: Fred_FS 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.
Title: Prevent window repaint
Post by: Laurent 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.