aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_win.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/pugl_win.cpp')
-rw-r--r--pugl/pugl_win.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/pugl/pugl_win.cpp b/pugl/pugl_win.cpp
index 6185c91..2ae832b 100644
--- a/pugl/pugl_win.cpp
+++ b/pugl/pugl_win.cpp
@@ -55,6 +55,7 @@ struct PuglInternalsImpl {
HDC hdc;
HGLRC hglrc;
WNDCLASS wc;
+ double timerFrequency;
};
LRESULT CALLBACK
@@ -99,6 +100,10 @@ puglCreateWindow(PuglView* view, const char* title)
PuglInternals* impl = view->impl;
+ LARGE_INTEGER frequency;
+ QueryPerformanceFrequency(&frequency);
+ impl->timerFrequency = frequency.QuadPart;
+
if (!title) {
title = "Window";
}
@@ -619,6 +624,14 @@ puglGetProcAddress(const char* name)
return (PuglGlFunc)wglGetProcAddress(name);
}
+double
+puglGetTime(PuglView* view)
+{
+ LARGE_INTEGER count;
+ QueryPerformanceCounter(&count);
+ return double(count.QuadPart) / view->impl->timerFrequency;
+}
+
void
puglPostRedisplay(PuglView* view)
{