[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] scrolling maps



Chris wrote:
> I've been implementing scrolling by drawing the entire map onto a surface
> larger than the display window, and blitting only the visible portion of the
> full map surface to the display window. Are there any disadvantages to doing
> it this way? I could well be wrong, but at a guess it seems to me that this
> would be faster than nested for loops.

using a single image will definitely be faster. the big tradeoff will be
the amount of memory used. for large scrolling areas the single image is
probably not an option. but for just several screens worth of image, one
large version could be better.

by reusing some python objects, you could technically unroll the two loops
into one, but i'm not sure if it would really outweigh the amount of time
actually blitting. usually nested loops in python are a sure spot for
performance problems.





____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org