|
@@ -40,7 +40,6 @@ static BOOL hires_timer_available;
|
|
|
static LARGE_INTEGER hires_start_ticks;
|
|
|
/* The number of ticks per second of the high-resolution performance counter */
|
|
|
static LARGE_INTEGER hires_ticks_per_second;
|
|
|
-#endif
|
|
|
|
|
|
static void
|
|
|
timeSetPeriod(UINT uPeriod)
|
|
@@ -76,13 +75,15 @@ SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValu
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#endif /* !USE_GETTICKCOUNT */
|
|
|
+
|
|
|
void
|
|
|
-SDL_InitTicks(void)
|
|
|
+SDL_TicksInit(void)
|
|
|
{
|
|
|
if (ticks_started) {
|
|
|
return;
|
|
|
}
|
|
|
- ticks_started = TRUE;
|
|
|
+ ticks_started = SDL_TRUE;
|
|
|
|
|
|
/* Set first ticks value */
|
|
|
#ifdef USE_GETTICKCOUNT
|
|
@@ -98,11 +99,26 @@ SDL_InitTicks(void)
|
|
|
hires_timer_available = FALSE;
|
|
|
timeSetPeriod(1); /* use 1 ms timer precision */
|
|
|
start = timeGetTime();
|
|
|
+
|
|
|
+ SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
|
|
+ SDL_TimerResolutionChanged, NULL);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+SDL_TicksQuit(void)
|
|
|
+{
|
|
|
+#ifndef USE_GETTICKCOUNT
|
|
|
+ if (!hires_timer_available) {
|
|
|
+ SDL_DelHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
|
|
+ SDL_TimerResolutionChanged, NULL);
|
|
|
+
|
|
|
+ timeSetPeriod(0);
|
|
|
}
|
|
|
#endif
|
|
|
|
|
|
- SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
|
|
- SDL_TimerResolutionChanged, NULL);
|
|
|
+ ticks_started = SDL_FALSE;
|
|
|
}
|
|
|
|
|
|
Uint32
|
|
@@ -114,7 +130,7 @@ SDL_GetTicks(void)
|
|
|
#endif
|
|
|
|
|
|
if (!ticks_started) {
|
|
|
- SDL_InitTicks();
|
|
|
+ SDL_TicksInit();
|
|
|
}
|
|
|
|
|
|
#ifdef USE_GETTICKCOUNT
|