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

[pygame] Re: Problem loading 48 sounds?



Sam Bull <sam.hacking@...> writes:

> 
> On Wed, 2015-07-29 at 01:49 -0700, rockachu2@... wrote:
> > The dirty rects are done correctly. When you call most draw functions
pygame returns a "dirty rect"--that
> is, a rect that squares off the area of the surface that has changed. If
you call update() with rects or a rect
> as an argument it only updates those spots on the screen/surface and thus
does not have to process the full
> screen. 
> > It's much faster.
> 
> Right, so it's only updating the keys, and not the background.
> 
> BUT, it is still redrawing the area for ALL keys (which appears to be
> atleast half the screen), instead of only the single key which has
> changed. My second suggestion will still make sure only the single key
> is redrawn.
> 
Thanks Sam for the code and Michael for all the explanation (and your
suggestion: Yes I'm on linux with Python3.4)!
It was indeed a problem with the preloading of the pictures: Now, I'm at 60
FPS without problem. I did find this hint inside the tutorial I was
following... 

@Sam: About the dirty sprite updating problem: 
I didn't manage to get it working with your proposed solution. Maybe I will
try a little later when I will be a bit more versed into Sprite in Pygame.
For the moment, it's working at 60FPS so I leave it like that...