#ifndef _CTIMING_HPP_ #define _CTIMING_HPP_ /*** SDL Header Files ***/ #include /*** DLL Header File ***/ #include #define MAXIMUM_FRAME_RATE 120 #define MINIMUM_FRAME_RATE 15 #define UPDATE_INTERVAL (1.0 / MAXIMUM_FRAME_RATE) #define MAX_CYCLES_PER_FRAME (MAXIMUM_FRAME_RATE / MINIMUM_FRAME_RATE) namespace TimingEngine { /* Singleton */ class EXPORT_FROM_MYDLL cTiming { private: cTiming( const unsigned long int ftp = 30 ); ~cTiming(); public: cTiming& operator=( const cTiming& copy ); /// Functions static cTiming& Inst(); static void Delete(); const bool Initialize() const; /* Sets up timing */ void Setup(); void CleanUp(); /* Sleeps if need */ void Time(); /// Sets void setFTP( const unsigned long int ftp = 30 ); /// Gets const unsigned long int getFTP() const; /* Gets return true if Timer was initialized */ const bool IsInit() const; const float getFrameTime() const; private: const unsigned long int TimeLeft(); void AddTimeandRate(); const float FrameTime(); private: /// Variables unsigned long int m_nextTime;/// = 0 unsigned long int m_rate;/// = (1000 / m_ftp) unsigned long int m_ftp;/// = 30 static cTiming* sp_inst;/// = nullptr unsigned long int m_start;/// = 0 float m_lastTime;/// = 0.0 float m_frameTime;/// = 0.0 };/// END CLASS DEFINITION cTiming }/// END NAMESPACE DEFINITION TimingEngine #endif/// END IFNDEF _CTIMING_HPP_