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

Re: [pygame] Re: fundamental (stupid) question about blitting part of a background image



On 2/3/06, Horst F. JENS <horst.jens@xxxxxx> wrote:
> Hi Brian,
> thank you for the fast answer.
> I will look up 'dirty rectangles' and medidate some time over your code.
>  From the first glance, it remind me a lot of the sprites methods.
> What does the source, dest in the 'blit' function mean ?
> Source and Dest are coordinates or Rectangles ?
> bye,
>         /Horst
>
I don't really use pygame sprites so I don't know them that well. My
impression is that they support dirty rect updating fine, but I don't
think getting dirty rect stuff from them is automatic.

With respect to the blit function, I was naming the args to match the
pygame docs for surface.blit. The idea behind the blit function is
that you would call it just like you would on the underlying display
surface, except the Dirty Rect wrapper would keep track of what the
areas in the display surface got made "dirty" and need to be made
clean later.

So in the case of the blit func, source would be the source pygame
surface (in your case, the star image) and dest would be either a
2-element position or a rect (same as surface.blit)

With respect to dirty rect systems in general, if you are going to
make a scrolling game, or you are getting just as much framerate as
you need then it's not worth worrying about. It should just be
something to keep in mind in case you need it & can use it.