[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Update performance
Pete Shinners wrote:
>> 4) Rect.union() is pretty good. >
>> 5) Something unexpected is going on with overlapping rects.
>> 6) Passing a list of rects to display.update() is very good.
>
>
> yes, this is one of the main reasons rect.union exists. you'll
> notice in the aliens example, there are always two rects to
> clear a sprite and draw the new one. these two are nearly always
> overlapping and its worthwhile to get a union of these two without
> even checking.
Would it be even faster to just have the sprite return a padded rectangle?
It's bounding box plus it's maximum movement per cycle added to each side.
This would take care of getting a union of it's current place and the place
it was just at (5 pixels to the left). Does that make sense?
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org