m_time.h

来自「C++课程大学作业的一次任务」· C头文件 代码 · 共 47 行

H
47
字号
////////////////////////////////
//        M_TIME.H
// CLASS M_Time
// 	IN-GAME TIME SIGNAL GENERATOR
//
// PROJECT: Ultra Pac Man
// LAST UPDATE: Nov. 12th 2001
// PROGRAMER: Mal
////////////////////////////////

//USAGE: JUST AS ANY OF OUR SINGLE INSTANCE CLASSES, WE HAD
//       PREPARED YOU A PRE-DEFINED GLOBAL POINTER. IN THIS
//       CASE, IT'S thisTimer


//MILLISECOND RESOLUTION TIMER SOURCE FROM
//       http://www.mhonline.net/~chuckh/software.html
#include "millisec.h"
#include "m_common.h"

#ifndef M_TIME
 #define M_TIME
class M_Time
{
 public:
		   M_Time();
	void   Reset(); //Reset in-game timer(frame counter)
	long   CreateSnapshot();
	bool   SetMaxFPS(float DesiredFPS);//Desired FPS can be a number between 1~1000
	void   FPSDelay();//auto FPS delay function
	long   GetFrameCounter();
	float  GetFPS();
	float  GetMaxFPS();

 private:
	long lFrameCounter;//Frame Counter, the in-game timer
	long lCurTime;//Real time
	float fMaxFPS;
	float fFPS;//Actual FPS reports by function
	float fFrameTime;//Calculated number,shows how long does a frame take
	long lNextFrameTime;//Calculated next frame start time(Real time)
};

extern M_Time* thisTimer;
#endif

⌨️ 快捷键说明

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