⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 md_timer.h

📁 我用MDEngine写的游戏
💻 H
字号:
//********************************************************************
//						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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -