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

RE: [pygame] Substantial Lag

From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx] On Behalf Of Santiago Romero
Sent: Monday, February 13, 2012 2:16 AM
To: pygame-users@xxxxxxxx
Subject: Re: [pygame] Substantial Lag


> > In order to save CPU power, do I need to put in a pygame.time.delay(10) at the end of my event loop?

> No.
> clock() does already that, forcing your program to run at N fps by "idle-ing" it enough time to run it at the desired speed.

I really apologize for all these posts, but I’m trying to get a handle on this, and I’m not finding what I need on Google.

What sort of syntax do I need to use to get the clock to handle all of this for me? I tried using pygame.clock.tick with no parameters, and my CPU useage jumped 30%. I tried just instantiating the clock and got the same result. The only thing that kept the CPU useage minimal was to throw in a pygame.time.wait(10) at the end of each iteration of the event loop.

If clock can force my program to run at a desired speed, how do I program it to do so? Do I use clock.tick at a certain framerate, for instance?

Thanks, really, for all the help.