My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 466: Clock.tick() always scheduling events in the past.
3 people starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----


Sign in to add a comment
 
Reported by reddoo...@gmail.com, Feb 5, 2010
Unless I'm missing something line 308 (in version 1.1.4) in clock.py will 
always schedule an event in the past.

Current line:
item.next_ts = item.last_ts + item.interval

It should either be:
item.next_ts += item.interval
or
item.next_ts = ts + item.interval

On my computer the first option allows me to move an image across the
screen smoothly where as the second option always makes for jerky movement.

An example to make it clearer.
Lets say an event wants to run at 25 fps, it would start with:
last_ts = 0.000
next_ts = 0.040
interval = 0.040

When Clock.tick() gets around to calling the event (before the check to see
if next_ts is in the past) you end up with.
ts >= 0.040
next_ts = 0.000 + 0.040
last_ts = ts

So next_ts is now in the past.
Sign in to add a comment

Powered by Google Project Hosting