Advertisement
Suby

timer.h

Jun 1st, 2012
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. /*Timer class taken from Lazy Foo' Productions [http://lazyfoo.net/index.php]*/
  2.  
  3. #ifndef TIMER_H
  4. #define TIMER_H
  5.  
  6. class Timer
  7. {
  8.     private:
  9.     int interval;
  10.  
  11.     //The clock time when the timer started
  12.     int startTicks;
  13.    
  14.     //The ticks stored when the timer was paused
  15.     int pausedTicks;
  16.    
  17.     //The timer status
  18.     bool paused;
  19.     bool started;
  20.    
  21.     public:
  22.     //Initializes variables
  23.     Timer();
  24.    
  25.     //The various clock actions
  26.     void start();
  27.     void stop();
  28.     void pause();
  29.     void unpause();
  30.     void setInterval(int value);
  31.    
  32.     int getInterval();
  33.    
  34.     //Gets the timer's time
  35.     int get_ticks();
  36.    
  37.     //Checks the status of the timer
  38.     bool is_started();
  39.     bool is_paused();    
  40. };
  41.  
  42. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement