topical media & game development

talk show tell print

graphic-processing-learning-18-example-18-7-Timer.pde / pde



  // Learning Processing
  // Daniel Shiffman
  // http://www.learningprocessing.com
  
  // Example 18-7: Loading a URL with simpleML
  
  // Timer Class from Chapter 10
  
  class Timer {
    
    int savedTime;
    boolean running = false;
    int totalTime;
    
    Timer(int tempTotalTime) {
      totalTime = tempTotalTime;
    }
    
    void start() {
      running = true;
      savedTime = millis();
    }
    
    boolean isFinished() {
      int passedTime = millis() - savedTime;
      if (running && passedTime > totalTime) {
        running = false;
        return true;
      } else {
        return false;
      }
    }
  
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.