📄 m_time.h
字号:
////////////////////////////////
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -