[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Difference between flip and update?



Hi again, Bob.

From a teaching standpoint...

flip updates the entire screen by swapping display buffers each game loop.

update uses dirty rects to define the regions that need to be drawn each game loop.

update is harder to learn and use. You have to track the areas of the screen that were changed by your rendering operations (blit, draw, set_at) and pass a list of the tracking rects to update. There is a point of diminishing returns, where flip would become more efficient. So you have to know your app. There are special dirty sprite groups and sprites for use with the update approach.

flip is easy as pie. Gumm says, "Just use flip." If you ever need to use update (very unlikely, in my opinion) you can struggle with it later. The lost routinely show up in #pygame in IRC when they try to use flip. :) But if you want an example for your students it would be worth the effort.

Gumm

On 8/26/2015 10:40 AM, Bob Irving wrote:
What is the difference? Is there a reason to use one over the other?

Thanks!
Bob Irving
Porter-Gaud School
Charleston, SC