home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR41 / DFPP02.ZIP / TIMER.H < prev    next >
C/C++ Source or Header  |  1993-08-15  |  697b  |  31 lines

  1. // ----------- timer.h
  2.  
  3. #ifndef TIMER_H
  4. #define TIMER_H
  5.  
  6. #include "dflatdef.h"
  7.  
  8. const int TIMER = 8;        // timer interrupt vector
  9. const int MAXTIMERS = 5;    // maximum timers at one time
  10.  
  11. class Timer    {
  12.     int timer;
  13.     static Timer *timers[MAXTIMERS];
  14.     static int timerct;
  15.     static void interrupt (*OldTimer)(...);
  16.     friend void interrupt NewTimer(...);
  17. public:
  18.     Timer();
  19.     ~Timer();
  20.     Bool TimedOut()             { return (Bool) (timer == 0); }
  21.     void SetTimer(int ticks) { timer = ticks; }
  22.     void DisableTimer()      { timer = -1; }
  23.     Bool TimerRunning()      { return (Bool) (timer > 0); }
  24.     void Countdown()          { --timer; }
  25.     Bool TimerDisabled()      { return (Bool) (timer == -1); }
  26. };
  27.  
  28. #endif
  29.  
  30.  
  31.