Reputation: 351
I noticed you need 2 steps to draw something in Pygame, first use surface.blit(), and then use display.update(). Why doesn't surface.blit() draw the object directly?
Thank you!
Upvotes: 2
Views: 180
Reputation: 11603
It is useful because it allows you to further modify the window before actually changing it.
Imagine you want to use more than just surface.blit()
but potentially dozens of functions.
Updating a window takes a memory space and time.
You would want to keep these two things to a minimum. If you wanted to apply multiple things to your window rather than keep updating everything as soon as it is called it waits until you have applied all changes then you can tell it to update the window once.
Why use it when you use only one function? Simply because it cannot "guess" that you only want one function. It is more efficient for you to tell it when to update the window.
Upvotes: 3