📄 timer.cpp
字号:
#include "StdAfx.h"
#include "timer.h"
Timer::Timer()
{
}
Timer::~Timer()
{
}
bool Timer::Init()
{
_beginTime = 0.0f;
_endTime = 0.0f;
_lastTime = 0.0f;
_isBegin =false;
_isEnd =false;
return true;
}
void Timer::Begin()
{
if(!_isBegin)
{
_beginTime = (float)::timeGetTime()*0.001f;
_isBegin = true;
}
if(!_isEnd)
_lastTime = (float)::timeGetTime()*0.001f - _beginTime;
}
void Timer::End()
{
if(!_isEnd)
{
_endTime = (float)::timeGetTime()*0.001f;
_isEnd = true;
}
}
float Timer::GetLastTime()
{
return _lastTime;
}
bool Timer::Wait(float time)
{
Begin();
if( _lastTime >= time )
{
End();
return true;
}
else
return false;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -