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

Re: [pygame] Pygame runs faster when mouse is moved



Greg Ewing wrote:
Kamilche wrote:
I'm encountering an interesting artifact in my 'falling snow' routine. When I wave the mouse around, for no reason, the snow appears to fall faster.

My guess is that you're taking a time step in your animation every time your get-events call wakes up. Moving the mouse generates mouse-movement events, each of which causes your animation to advance.

The solution is to only take a time step when you
get whatever event you've set up to fire when
your frame timer expires. You can render at other
times if you want, but only timer events should
cause the animation to advance.


Yeah, it was something like that. The screen render loop was separate from the weather loop. I made the screen update loop fire off the weather loop, and only when there was a dirty rectangle on the screen.


--Kamilche