[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] 99 CPU use?
I recently wrote a pygame app that did this. I wanted a 900x900 screen,
and the loop was just killer on the CPU, I took out the screen drawing
from the loop and just drew when there was a new event. Now the CPU usage
is basically 0%.
What I just did in my project was draw one sprite group to the screen
surface per cycle and only on cycles where the top-most group is drawn
do I flip the screen. I also don't draw anything if, as you said, no
changes have been made. This didn't really seem to help the visible FPS
but it did make input processing feel smoother.. I suspect because it's
not blocking the input as long while drawing the screen. It did seem to
reduce the CPU load a bit too.