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

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



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.

--
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | Carpe post meridiem!          	  |
Christchurch, New Zealand	   | (I'm not a morning person.)          |
greg.ewing@xxxxxxxxxxxxxxxx	   +--------------------------------------+