[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] pygame.time updates



i've just checked in quite a few changes for the pygame.time module.
here's what we've got...

time.delay() now is very accurate, but uses CPU
time.wait() is new, and works like the old delay (inaccurate, no cpu)
both delay() and wait() now also return the actual milliseconds used
time.Clock() returns a new clock object

the clock objects replace the functionality of both the "FpsClock" 
entries in the PCR (sorry david, we may want to snip them soon?)

you can read the docs for the new stuff here
http://www.pygame.org/docs/ref/pygame_time.html
http://www.pygame.org/docs/ref/Clock.html

i'm still going to be testing on these more, but they seem to work 
really well. the only "controversy" might be how i've changed the 
time.delay() function. my thoughts were that any games really using it 
want it to be accurate (instead of the current give or take 10ms). any 
programs that were using time.delay() to keep the program from using 
100% cpu are now going to be taking close to 100% of the cpu. i figured 
these would be mostly little demos, so it wouldn't be as big a deal if 
they became a little less "system friendly". you can now use time.wait() 
if you really want the app to "sleep" and share the cpu.

anyone think this is a bad idea? if so, let me know now and i won't be 
at all opposed to switching delay() to work like it used to, and make 
some new function like "burn" that trades cpu for accuracy.

anyways, if you're in a position to test the new time stuff out, please 
do. i'll be working on them too.

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org