00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_FRAMEHANDLER_HPP_)
00012 #define _XRB_FRAMEHANDLER_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 namespace Xrb
00017 {
00018
00026 class FrameHandler
00027 {
00028 public:
00029
00033 FrameHandler ();
00037 virtual ~FrameHandler ();
00038
00042 inline Float MostRecentFrameTime () const { return Max(m_most_recent_time, 0.0f); }
00046 inline Uint32 FrameCount () const { return m_frame_count; }
00047
00048
00049
00053 inline void SetSkipTime (bool const skip_time) { m_skip_time = skip_time; }
00054
00059 void ProcessFrame (Float const time);
00060
00061 protected:
00062
00068 inline Float FrameTime () const
00069 {
00070 ASSERT1(m_lock > 0);
00071 return m_most_recent_time;
00072 }
00077 inline Float FrameDT () const
00078 {
00079 ASSERT1(m_lock > 0);
00080 return m_frame_dt;
00081 }
00082
00088 virtual void HandleFrame () = 0;
00089
00090 private:
00091
00092
00093 void StartFrame (Float const time);
00094
00095 void EndFrame ();
00096
00097
00098 Uint32 m_lock;
00099
00100
00101 Float m_most_recent_time;
00102
00103 Float m_frame_dt;
00104
00105 Uint32 m_frame_count;
00106
00107
00108 bool m_skip_time;
00109 };
00110
00111 }
00112
00113 #endif // !defined(_XRB_FRAMEHANDLER_HPP_)
00114