Permalink
Browse files

Rest of a fix to prevent advancing out of the last slide.

- If within UPDATES_PER_SECOND/2 of the stopping time, suppress the
  slide advance.
  • Loading branch information...
1 parent bfcd2ff commit b562e7c67d1a5bde8a946bdbd4c58f0933d1f881 @kamitchell kamitchell committed Oct 23, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 MyAppDelegate.m
View
4 MyAppDelegate.m
@@ -98,7 +98,9 @@ - (void) tick:(NSTimer*) timer {
{
self.secondsElapsed += 1.0 / UPDATES_PER_SECOND;
- if ((int)floor(UPDATES_PER_SECOND * self.secondsElapsed) % (UPDATES_PER_SECOND * SECONDS_PER_SLIDE) == 0)
+ bool justAboutDone = (self.secondsElapsed > ((NUMBER_OF_SLIDES * SECONDS_PER_SLIDE) - (1.0f / UPDATES_PER_SECOND / 2.0f)));
+ if ( !justAboutDone &&
+ ((int)floor(UPDATES_PER_SECOND * self.secondsElapsed) % (UPDATES_PER_SECOND * SECONDS_PER_SLIDE) == 0))
[self advanceSlide];
}
else

0 comments on commit b562e7c

Please sign in to comment.