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

[pygame] timing issues



i was noticing the aliens example was running at different speeds
under different platforms. curiously, i looked at the wait_frame()
function in this example and was... disappointed.

looking at the code i don't see how i even expected it to work.
anyways, this was likely having adverse effects on most people's
enjoyment of aliens.

if anyone was using wait_frame to keep your own project running at
a fixed framerate, i suggest you don't rely on it for anything.
i've changed the wait_frame() in the aliens example to something
that works. along with this comes a couple quick changes to 
pygame.time.delay()

at one point i had changed delay() to try to round-down any
timing errors. (this type of rounding done in several SDL examples).
this rounding made it impossible for me to get any kind of consistent
timing out of my applications, so delay() has been switched back to
use the exact time you pass.

unless--
when passing negative values to delay() they were being converted
to unsigned values. this means a delay() of -1 would really end up
being a really long delay. the minimum delay value is now 0, but
when passed a negative delay pygame will still call all the
necessary delay functions, which will help balance multiple threads
nicer.

anyways, quick little changes, but i wanted to mail out and warn
anyone using the wait_frame() function from the aliens example.


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