home *** CD-ROM | disk | FTP | other *** search
/ Introduction to 3D Game …ogramming with DirectX 12 / Introduction-to-3D-Game-Programming-with-DirectX-12.ISO / Code.Textures / Common / GameTimer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2016-03-02  |  789 b   |  34 lines

  1. //***************************************************************************************
  2. // GameTimer.h by Frank Luna (C) 2011 All Rights Reserved.
  3. //***************************************************************************************
  4.  
  5. #ifndef GAMETIMER_H
  6. #define GAMETIMER_H
  7.  
  8. class GameTimer
  9. {
  10. public:
  11.     GameTimer();
  12.  
  13.     float TotalTime()const; // in seconds
  14.     float DeltaTime()const; // in seconds
  15.  
  16.     void Reset(); // Call before message loop.
  17.     void Start(); // Call when unpaused.
  18.     void Stop();  // Call when paused.
  19.     void Tick();  // Call every frame.
  20.  
  21. private:
  22.     double mSecondsPerCount;
  23.     double mDeltaTime;
  24.  
  25.     __int64 mBaseTime;
  26.     __int64 mPausedTime;
  27.     __int64 mStopTime;
  28.     __int64 mPrevTime;
  29.     __int64 mCurrTime;
  30.  
  31.     bool mStopped;
  32. };
  33.  
  34. #endif // GAMETIMER_H