home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / gamesystem / includes / gs_timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-11  |  1.2 KB  |  68 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    gsCTimer
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    12/03/00
  8. //
  9. // Base:    gsCObject
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #ifndef _INCLUDE_GS_TIMER_H
  16. #define _INCLUDE_GS_TIMER_H
  17.  
  18. //-------------------------------------------------------------
  19. // Valid timer states
  20.  
  21. typedef enum {
  22.     gsTIMER_RESET,
  23.     gsTIMER_ACTIVE,
  24.     gsTIMER_PAUSED
  25. } gsTimerState;
  26.  
  27. //-------------------------------------------------------------
  28. // Timer Class
  29.  
  30. class gsCTimer : public gsCObject
  31. {
  32.     private:
  33.         float m_base_time;
  34.         gsTimerState m_state;
  35.  
  36.         static __int64 m_freq;
  37.         static __int64 m_time0;
  38.  
  39.         static float m_previous_time;
  40.         static float m_system_time;
  41.  
  42.         static float m_fake_time;
  43.  
  44.     public:
  45.         gsCTimer();
  46.         virtual ~gsCTimer();
  47.  
  48.         static void initialize();
  49.  
  50.         static void update(bool frame_done);
  51.  
  52.         void reset();
  53.         void start();
  54.         void pause();
  55.         void unpause();
  56.  
  57.         gsTimerState getState();
  58.         float getTime();
  59.  
  60.         static float getDeltaTime();
  61.  
  62.         static float getCurrentTime();
  63. };
  64.  
  65. //-------------------------------------------------------------
  66.  
  67. #endif
  68.