https://www.youtube.com/watch?v=c8sc_w-g3-A
Timer startTimer;
void setup()
{
  size(600,600);
   startTimer = new Timer(10);
}
void draw()
{
  background(200);
  startTimer.countUp();
  fill(0);
  text(startTimer.getTime(),20,20);
}
class Timer
{
  float Time;
  
  Timer(float set)
  {
    Time = set;
  }
  float getTime()
  {
    return(Time);
  }
  void setTime(float set)
  {
    Time = set;
  }
  void countUp()
  {
    Time +=1/frameRate;
  }
  void countDown()
  {
    Time -=1/frameRate;
  }
        
}
  
 
 
 
No comments:
Post a Comment