diff --git a/include/polycode/core/PolyWinCore.h b/include/polycode/core/PolyWinCore.h index d988c8cce..b028a0fbf 100644 --- a/include/polycode/core/PolyWinCore.h +++ b/include/polycode/core/PolyWinCore.h @@ -288,6 +288,8 @@ class Gamepad_devicePrivate { // frequency of the windows performance counter double pcFreq; + // Initial Value of the performance counter + int PerfInitial; // Tracks whether the system supports multitouch at runtime bool hasMultiTouch; diff --git a/src/core/PolyWinCore.cpp b/src/core/PolyWinCore.cpp index 43f02ee31..d764345f4 100644 --- a/src/core/PolyWinCore.cpp +++ b/src/core/PolyWinCore.cpp @@ -138,6 +138,7 @@ Win32Core::Win32Core(PolycodeViewBase *view, int _xRes, int _yRes, bool fullScre LARGE_INTEGER li; QueryPerformanceFrequency(&li); pcFreq = double(li.QuadPart)/1000.0; + PerfInitial = 0; setVSync(vSync); @@ -206,6 +207,8 @@ void Win32Core::warpCursor(int x, int y) { unsigned int Win32Core::getTicks() { LARGE_INTEGER li; QueryPerformanceCounter(&li); + if (PerfInitial == 0) + PerfInitial = li.QuadPart; return (unsigned int)(li.QuadPart / pcFreq); }