Reputation: 1156
Although I understand that the purpose of the draw function is to draw to a certain surface, I don't understand why it doesn't simply return a pygame.Surface object that you can later blit to a surface whenever needed. So far this has been very inconvenient when I just want to create a surface and draw it to something else later.
Is there any way that you can get similar functions to return a surface object, instead of going that extra step and drawing directly to another surface?
Upvotes: 1
Views: 509
Reputation: 909
To make a surface with the shape you want, instead of drawing to the original surface, you draw to another surface and then later you can blit it to the original one.
As to why the draw functions return a rect, it serves to later optimise your code by only updating the parts of the screen that need to be updated. The way you do this is every time you want to draw something to the screen, you append the rect that it returns to a list and when you go to update the screen you do it like so:
pygame.display.update(rect_list)
Upvotes: 1