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

📄 timehandling.h

📁 CS作弊器源代码,用易语言编写...简单适用,适合新人!~~~~
💻 H
字号:
#ifndef TIMEHANDLING_H
#define TIMEHANDLING_H

//===============================================================
// class ClientTime:
//      provides a stable time base, independent of map changes.
//===============================================================
class ClientTime 
{
public:
	static void   reportMapTime(float newMapTime);
	static float  mapTime;  // how long did the current map run?

	static void   updateCurrentTime();
	static double current;    // seconds counter
	static DWORD  current_ms; // ms counter

protected:
//	static double timeoffset;
};

//===============================================================
// class StopTimer
//      
//===============================================================
class StopTimer
{
public:
	StopTimer() :expirationTime(0)       {}

	void  countdown( double seconds ) { expirationTime = ClientTime::current + seconds; }
	bool  running () { return (ClientTime::current<=expirationTime); }
	bool  expired () { return (ClientTime::current> expirationTime); }
	float timeleft() { return float(expirationTime-ClientTime::current);  }
	void  setExpired() { expirationTime=0;                           }
	void  setRunning() { expirationTime=1000000;                     }

protected:
	double expirationTime;
};

//===============================================================
// class RunningStopTimer
//      
//===============================================================
class RunningStopTimer : public StopTimer { public: RunningStopTimer(){expirationTime=1000000;} };


//===============================================================
// class EventCounter
//      
//===============================================================
template < float Interval, int MaxEvents = 12 >
class EventCounter
{
public:
	// returns number of events since last call, maximal 12
	int  get()
	{
		register int n = 0;
		while(reftime<ClientTime::current)
		{
			reftime += Interval;
			++n;
			if(n>MaxEvents) { reset(); return 1; }
		}
		return n;
	}

	EventCounter()  {reset();}

protected:
	void   reset() {reftime = ClientTime::current;}
	double reftime;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -