md_timer.h
来自「我用MDEngine写的游戏」· C头文件 代码 · 共 49 行
H
49 行
//********************************************************************
// MD 引擎 计时器 部件的定义
// Powered by @J--S Studio Johnhans 2003.4.10
//********************************************************************
#ifndef MD_TIMER_H
#define MD_TIMER_H
#ifdef MDENGINE_EXPORTS
#define MDENGINE_API __declspec(dllexport)
#else
#define MDENGINE_API __declspec(dllimport)
#endif
class MDENGINE_API CMD_Timer
{
public:
CMD_Timer();
virtual ~CMD_Timer();
public:
bool IsTimeUp(long time); // 查询第一次设置前离现在是否满time毫秒
void TimeWait(long time); // 强行系统等待time毫秒。
void Reset();
inline unsigned long GetCounted(void);
unsigned long StartPerfCount(bool EnReset=false);
unsigned long EndPerfCount(bool AutoRestart=false);
LONGLONG GetPerfFreq(void){return m_perfcnt;}
unsigned long StartCycleCount(bool EnReset=false);
unsigned long EndCycleCount(bool AutoRestart=false);
inline unsigned __int64 GetCycleCount(void);
private:
unsigned long m_TimeOld;
bool m_bCounting;
bool m_bPerformance;
LONGLONG m_perfcnt;
// Performance 计时器成员
unsigned __int64 m_PerCnt;
// RDSTC 计时器成员
unsigned __int64 m_CycCnt; // 本次计时的初始值
};
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?