00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CFRAMELIMITER_HPP_INCLUDED
00020 #define CFRAMELIMITER_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
00038
00039 #include "start_code.hpp"
00040 #include "SINGLETON.hpp"
00041
00042 #define g_pcFrameLimiter cFrameLimiter::Get()
00044 namespace SPACE
00045 {
00046 namespace Core
00047 {
00053 class DLL_EXPORT cFrameLimiter : public TSingleton<cFrameLimiter>
00054 {
00055 public:
00056 cFrameLimiter();
00057 ~cFrameLimiter();
00058
00059
00060
00061
00062
00063
00064
00065
00066
00074 bool LimitFrameRate(bool _Limit, unsigned int _Fps = 0);
00075
00080 void Limit();
00081 private:
00082
00083 Uint32 m_CurTime;
00084 Uint32 m_LastTime;
00086
00087 bool m_bLimitFrame;
00088 float m_TimePerFrame;
00089 unsigned int m_FrameNumber;
00090 Uint32 m_TargetTime;
00091 };
00092 }
00093 }
00094
00095 #endif // CTIMER_HPP_INCLUDED