timers internally now use 64bit unsigned int, if available
[freeglut] / src / mswin / freeglut_main_mswin.c
index 290f161..8a13a84 100644 (file)
@@ -42,6 +42,20 @@ static pGetTouchInputInfo fghGetTouchInputInfo = (pGetTouchInputInfo)0xDEADBEEF;
 static pCloseTouchInputHandle fghCloseTouchInputHandle = (pCloseTouchInputHandle)0xDEADBEEF;
 #endif
 
+#ifdef _WIN32_WCE
+typedef struct GXDisplayProperties GXDisplayProperties;
+typedef struct GXKeyList GXKeyList;
+#include <gx.h>
+
+typedef struct GXKeyList (*GXGETDEFAULTKEYS)(int);
+typedef int (*GXOPENINPUT)();
+
+GXGETDEFAULTKEYS GXGetDefaultKeys_ = NULL;
+GXOPENINPUT GXOpenInput_ = NULL;
+
+struct GXKeyList gxKeyList;
+#endif /* _WIN32_WCE */
+
 /* 
  * Helper functions for getting client area from the window rect
  * and the window rect from the client area given the style of the window
@@ -108,17 +122,25 @@ void fgPlatformDisplayWindow ( SFG_Window *window )
 }
 
 
-unsigned long fgPlatformSystemTime ( void )
+fg_time_t fgPlatformSystemTime ( void )
 {
 #if defined(_WIN32_WCE)
     return GetTickCount();
 #else
+    /* TODO: do this with QueryPerformanceCounter as timeGetTime has
+     * insufficient resolution (only about 5 ms on system under low load).
+     * See:
+     * http://msdn.microsoft.com/en-us/library/windows/desktop/dd757629(v=vs.85).aspx
+     * Or maybe QueryPerformanceCounter is not a good idea either, see
+     * http://old.nabble.com/Re%3A-glutTimerFunc-does-not-detect-if-system-time-moved-backward-p33479674.html
+     * for some other ideas (at bottom)...
+     */
     return timeGetTime();
 #endif
 }
 
 
-void fgPlatformSleepForEvents( long msec )
+void fgPlatformSleepForEvents( fg_time_t msec )
 {
     MsgWaitForMultipleObjects( 0, NULL, FALSE, msec, QS_ALLINPUT );
 }