$search
00001 00009 #ifndef TG_TIMER 00010 #define TG_TIMER 00011 00012 #ifdef _WIN32 00013 #include <windows.h> 00014 #else 00015 #include <time.h> 00016 #include <sys/time.h> 00017 #endif 00018 00019 // *********************************************************************************** 00020 00021 namespace TomGine{ 00022 00026 class tgTimer 00027 { 00028 private: 00029 #ifdef WIN32 00030 LONGLONG m_StartTicks; // QueryPerformance - Ticks at application start 00031 LONGLONG m_EndTicks; // QueryPerformance - Ticks when calling Now() 00032 LONGLONG m_Frequency; // QueryPerformance - Fequency 00033 double fNow; 00034 #else 00035 struct timespec AppStart, act, old; 00036 #endif 00037 double m_fAppTime; // Time since application started 00038 double m_fTime; // Time between two Update calls 00039 00040 public: 00041 tgTimer(void); 00042 ~tgTimer(void); 00043 00044 void Reset(); 00045 double Update(); 00046 00047 double GetFrameTime(){ return m_fTime;} 00048 double GetApplicationTime(){ return m_fAppTime;} 00049 }; 00050 00051 } // namespace TomGine 00052 00053 #endif 00054