animation,throbber: go back to frame dropping

Right now we figure out which animation frame to use
based on a static counter variable.  Since it's static
instead of per-object, if there are multiple instances
it ends up counting up too fast.

We could:
1) make it per-object state
2) drop it and use the ifdef'd out alternative implementation
that potentially drops frames if the machine is sluggish

This commit chooses 2, but we may end up going to one if the
frame dropping turns out to be problematic.

Based on deductive work from Kevin Murphy.
This commit is contained in:
Ray Strode 2013-03-12 11:57:15 -04:00
parent 054d29019d
commit e2b0c7c772
2 changed files with 1 additions and 13 deletions

View file

@ -182,14 +182,8 @@ on_timeout (ply_animation_t *animation)
animation->previous_time = animation->now;
animation->now = ply_get_timestamp ();
#ifdef REAL_TIME_ANIMATION
should_continue = animate_at_time (animation,
animation->now - animation->start_time);
#else
static double time = 0.0;
time += 1.0 / FRAMES_PER_SECOND;
should_continue = animate_at_time (animation, time);
#endif
sleep_time = 1.0 / FRAMES_PER_SECOND;
sleep_time = MAX (sleep_time - (ply_get_timestamp () - animation->now),

View file

@ -178,14 +178,8 @@ on_timeout (ply_throbber_t *throbber)
bool should_continue;
throbber->now = ply_get_timestamp ();
#ifdef REAL_TIME_ANIMATION
should_continue = animate_at_time (throbber,
throbber->now - throbber->start_time);
#else
static double time = 0.0;
time += 1.0 / FRAMES_PER_SECOND;
should_continue = animate_at_time (throbber, time);
#endif
throbber->now - throbber->start_time);
sleep_time = 1.0 / FRAMES_PER_SECOND;
sleep_time = MAX (sleep_time - (ply_get_timestamp () - throbber->now),