예제 #1
0
 /**
  * Increments internal counters and posts the Event if necessary.
  *
  * @param timer The Timer controlling the timed Events
  * @param time The total time the Timer has been running
  */
 protected void tick(Timer timer, long time) {
   long diff = time - last;
   last = time;
   count += diff;
   total += diff;
   if (count >= duration && duration > 0) {
     timer.post(new UserEvent(timer, UserEvent.FIRST_ID, this));
     // This skips ticks when the timer is really busy
     while (count >= duration && duration > 0) count -= duration;
   }
 }