[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] help with subsurfaces
On Dec 12, 2007 1:10 PM, Dan Krol <orblivion@xxxxxxxxx> wrote:
> I need to do something similar, but I think I did it by just blitting
> the subsection of the original surface I needed when it's time to draw
> (and no other times). Doesn't this not use extra memory as well? Any
> reason this is a bad idea?
>
For organizational purposes, it may at some point be very unclear what
this means:
screen.blit(source.subsurface([30,60,100,15]),[30,60])
Whereas this might make more sense:
screen.blit(player_head,[30,60])
Also, the little bit of memory used in predefining a subsurface is
going to gain some performance increase, which in blitting you really
need as much as you can get.
Also, if you are meaning you do things thusly:
screen.blit(source,[30,60],[30,60,100,15]) this probably is as fast
and as memory concious, but to me is even more confusing because the
area defined belongs to the source but comes AFTER the coordinates. I
would forget what that rect is associated with.
But if it works for you, then do it that way :)