add input

add time
This commit is contained in:
2025-09-24 15:37:58 +02:00
parent 10d4f9fd1b
commit 589d0933f4
4 changed files with 95 additions and 15 deletions
+19
View File
@@ -1,12 +1,31 @@
#include "Time.h"
#if _DEBUG
#include <string>
#endif // _DEBUG
UINT Time::init()
{
_lastFrame = CLOCK::now();
return 0;
}
void Time::update()
{
TIMEPOINT now = CLOCK::now();
SECONDS diff = now - _lastFrame;
_lastFrame = now;
_deltaTime = diff.count();
#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()