00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CTIMER_HPP_INCLUDED
00020 #define CTIMER_HPP_INCLUDED
00021
00022 #undef AFX_EXT_CLASS
00023 #undef AFX_EXT_API
00024 #undef AFX_EXT_DATA
00025 #define AFX_EXT_CLASS AFX_CLASS_IMPORT
00026 #define AFX_EXT_API AFX_API_IMPORT
00027 #define AFX_EXT_DATA AFX_DATA_IMPORT
00028
00029 #include <SDL.h>
00030
00031 #undef AFX_EXT_CLASS
00032 #undef AFX_EXT_API
00033 #undef AFX_EXT_DATA
00034 #define AFX_EXT_CLASS AFX_CLASS_EXPORT
00035 #define AFX_EXT_API AFX_API_EXPORT
00036 #define AFX_EXT_DATA AFX_DATA_EXPORT
00037 #include "start_code.hpp"
00038 #include "ePurpose.hpp"
00039
00040
00041
00042 namespace SPACE
00043 {
00044 namespace Core
00045 {
00050 class DLL_EXPORT cTimer
00051 {
00052 friend class cTimerManager;
00053 public:
00056 cTimer(void (*_pFunction)(ePurpose _Purpose));
00057 ~cTimer();
00058
00066 bool Start(unsigned int _Length, bool _bDestroy = true, int _Repeat = 0);
00067
00071 void ForceStop(bool _bDestroy = true);
00072
00074 void Pause();
00075
00077 void Resume();
00078
00084 bool Reset();
00085
00091 bool ChangeRuntime(unsigned int _TotalRunTime);
00092
00098 bool ChangeReapeat(int _Repeat);
00099
00101 int GetRepeat() {return m_Repeat;}
00103 unsigned int GetRuntime() {return m_TotalDeltaTime;}
00105 unsigned int GetElapse() {return m_ElapsedTime;}
00106
00107 private:
00114 int Update(unsigned int _CurTime);
00115
00120 void Repeat(unsigned int _CurTime);
00121
00122 int Stop();
00123
00124 unsigned int m_StartTime;
00125 unsigned int m_TotalDeltaTime;
00126 unsigned int m_ElapsedTime;
00127 unsigned int m_TotalDeltaTimeBackup;
00130 int m_Repeat;
00132 void (*m_pFunction)(ePurpose _Purpose);
00134 bool m_bDestroy;
00135 bool m_bRunning;
00137 };
00138 }
00139 }
00140
00141 #endif // CTIMER_HPP_INCLUDED