FrameTimer.h
资源名称:estereo2.zip [点击查看]
上传用户:fengshi120
上传日期:2014-07-17
资源大小:6155k
文件大小:2k
源码类别:
3D图形编程
开发平台:
C/C++
- // FrameTimer.h: interface for the CFrameTimer class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_FRAMETIMER_H__D14E6BE0_144A_11D4_90C3_00AA00597E76__INCLUDED_)
- #define AFX_FRAMETIMER_H__D14E6BE0_144A_11D4_90C3_00AA00597E76__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- class CFrameTimer
- {
- public:
- CFrameTimer();
- virtual ~CFrameTimer();
- void Start(float fFramesPerSec);
- void Frame();
- float GetFramesPerSec() const;
- float GetSecsPerFrame() const;
- UINT64 GetTicks() const;
- UINT64 GetTicksPerSec() const;
- UINT64 GetTicksPerFrame() const;
- protected:
- float m_fTicksPerSec;
- float m_fFramesPerSec;
- float m_fSecsPerFrame;
- UINT64 m_qwTicks;
- UINT64 m_qwTicksPerSec;
- UINT64 m_qwTicksPerFrame;
- };
- //////////////////////////////////////////////////////////////////////////////
- // Inline methods ////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////
- inline float
- CFrameTimer::GetFramesPerSec() const
- {
- return m_fFramesPerSec;
- }
- inline float
- CFrameTimer::GetSecsPerFrame() const
- {
- return m_fSecsPerFrame;
- }
- inline UINT64
- CFrameTimer::GetTicksPerSec() const
- {
- return m_qwTicksPerSec;
- }
- inline UINT64
- CFrameTimer::GetTicksPerFrame() const
- {
- return m_qwTicksPerFrame;
- }
- #endif // !defined(AFX_FRAMETIMER_H__D14E6BE0_144A_11D4_90C3_00AA00597E76__INCLUDED_)