ctimer.h

来自「游戏开发人工智能技术-AI.Techniques.for.Game.Progra」· C头文件 代码 · 共 56 行

H
56
字号
#ifndef CTIMER_H
#define CTIMER_H
//-----------------------------------------------------------------------
//
//  Name: CTimer.h
//
//  Author: Mat Buckland 2002
//
//	Desc: Windows timer class for the book Game AI 
//  Programming with Neural Nets and Genetic Algorithms.
//
//-----------------------------------------------------------------------

#include <windows.h>


class CTimer
{

private:

	LONGLONG	m_CurrentTime,
	          m_LastTime,
				    m_NextTime,
				    m_FrameTime,
				    m_PerfCountFreq;

	double		m_TimeElapsed,
				    m_TimeScale;

	float		  m_FPS;


public:

  //ctors
	CTimer();
	CTimer(float fps);

	//whatdayaknow, this starts the timer
  void		Start();

	//determines if enough time has passed to move onto next frame
  bool		ReadyForNextFrame();

	//only use this after a call to the above.
	double	GetTimeElapsed(){return m_TimeElapsed;}

	double	TimeElapsed();

};

#endif

	

⌨️ 快捷键说明

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