Languages & Coding > C++ / C#

C++ and SDL2


I'm using SDL2 with C++ for a point and click menu system.
Should I redraw the back buffer on every pass of the input loop or just redraw the back buffer on every change.
'While prog is running, check for input, draw everything to back buffer , then flip.'
'While prog is running, check for input, draw changes to back buffer if any are needed , then flip.'

It's a hang over from Blitz where you would redraw everything on every pass.
Any advice appreciated, have fun cps.

I'd just draw every pass, I mean, it'll harm nothing, your main game loop will be doing it and will be more CPU/GPU intensive, basically, I wouldn't worry about it!


If it's not a game or virtual scene, then yes I believe the correct thing is to redraw only when something has changed, if you're multi-tasking this should reduce excess processing.

Ummm. I've never seen any deviant pixels in SDL2 relying on the back buffer's stability, so I'll only redraw changes at the moment.
When I get onto complex interactions (games) or if back buffer proves unstable, I'll go for redraw everything.
Many thanks for input. 'The Deviant Pixels' nice name for a band (well maybe)? Have fun cps.


[0] Message Index

Go to full version