Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/polycode/core/PolyWinCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/core/PolyWinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}

Expand Down