[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] hooking Surface
--- Pete Shinners <pete@shinners.org> wrote: > Beni
Cherniavsky wrote:
> > So I have a different idea that's more useful than
> [only] subclassing:
> > allow to set a hook (callback) on a Surface that
> will be called from the C
> > side with the changed rect after any update to the
> surface.
>
> i've had thoughts about this as well. but from my
> perspective i was
> thinking an "automatic dirty/update rectangles"
> management for the
> display surface would be excellent.
>
> the interface could use some potential thinking
> about. i would expect a
> "full" implementation would allow a program to turn
> the updates off and
> on for blocks of code, and then perhaps provide its
> own update data.
>
> this way the internal updating could be fairly
> 'dumb' and just pass the
> update rectangles as they happen. the programmer
> could then override the
> behavior, for example when drawing many small
> primitives (or set_at) in
> a small area.
>
> as a side note, the next logical step for this is to
> move from
> rectangles, to "regions" which would properly deal
> with overlapping
> areas and nonrectangular shapes. i know windows
> internally uses regions
> like this to define nonrectangular window shapes.
>
> instead of implementing a callback, i was thinking
> about simply
> collecting a stack of update rectangles. then you
> can find out what has
> been updated in any part of your program. although
> the callback method
> does let you share 'locking' between the drawing and
> the update.
>
> i'll be thinking about this deeper for a little, and
> i'm wide open to
> any thoughts on it. the biggest issues i'd want to
> work smooth are the
> 'automatic display rectangles' and the clean ways to
> handle "multiple"
> parts of a program interested in these updated
> regions.
>
On a slightly related topic:
How about a coverage buffer(cbuffer)? I've read these
can be very efficient, and can simplify your dirty
rect code lots. Especially when the number of sprites
goes up.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org