35 lines
572 B
C++
35 lines
572 B
C++
#include "Time.h"
|
|
#include <string>
|
|
|
|
UINT Time::init()
|
|
{
|
|
_lastTime = CLOCK::now();
|
|
|
|
return 0;
|
|
}
|
|
|
|
void Time::update()
|
|
{
|
|
TIME_POINT now = CLOCK::now();
|
|
SECONDS diff = now - _lastTime;
|
|
_deltaTime = diff.count();
|
|
_lastTime = now;
|
|
|
|
#ifdef _DEBUG
|
|
#ifdef UNICODE
|
|
wstring output = L"fps: " + to_wstring(1 / _deltaTime) + L"\n";
|
|
OutputDebugString(output.c_str());
|
|
#else // !UNICODE
|
|
string output = "fps: " + to_string(1 / _deltaTime) + "\n";
|
|
OutputDebugString(output.c_str());
|
|
#endif // UNICODE
|
|
|
|
|
|
#endif // DEBUG
|
|
|
|
}
|
|
|
|
void Time::deInit()
|
|
{
|
|
}
|