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

Re: [pygame] Dirty Rectangle Processing



Kamilche schrieb:
I worked up a small example to illustrate the dirtyrect
processing method I mentioned earlier.
If you can make this faster, post your results here!
Note that all sprites have an alpha channel that must be maintained.

A screenshot of the output of this sample program can be seen at:

http://www.kamilche.com/images/pygame/DirtyRectsExample.jpg

The original source can be found at:

http://www.kamilche.com/images/pygame/dirtyrects.py

It's a simple program that fills the screen with moving colored boxes,
and illustrates how to toggle between fullscreen and windowed mode in a
cross-platform-compatible way.  It displays the current FPS in the top
left corner.



--Kamilche

Hello


Thank you for that. It's astonishing fast! Congratulations!

I tested your code:
I have ~412 fps in windowed mode and ~610 fps in fullscreen on a PentiumM 1.5Ghz with 1GB ram and WinXP Prof.
(my LCD display is slow so I can see 4-6 rects lined up in the moving direction!!)



I think I have to re-think some parts of my design and code. I wanted to stay compatible with the exsiting pygame.sprite.Sprite's but now I'm not so sure anymore if this is a good idea.


I looked at your code and noticed, that I had forgotten about the clipping on a surface. That can make some thing faster.

~DR0ID