mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-17 11:38:49 +00:00
WinRT: build fixes and additional WinRT-related integrations with SDL 2.0.0
This commit is contained in:
parent
f7049b93d5
commit
d41fdc94d6
13 changed files with 110 additions and 31 deletions
|
|
@ -41,6 +41,7 @@ static LARGE_INTEGER hires_start_ticks;
|
|||
static LARGE_INTEGER hires_ticks_per_second;
|
||||
#endif
|
||||
|
||||
#ifndef __WINRT__
|
||||
static void
|
||||
timeSetPeriod(UINT uPeriod)
|
||||
{
|
||||
|
|
@ -74,6 +75,7 @@ SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValu
|
|||
timeSetPeriod(uPeriod);
|
||||
}
|
||||
}
|
||||
#endif /* ifndef __WINRT__ */
|
||||
|
||||
void
|
||||
SDL_StartTicks(void)
|
||||
|
|
@ -90,13 +92,19 @@ SDL_StartTicks(void)
|
|||
QueryPerformanceCounter(&hires_start_ticks);
|
||||
} else {
|
||||
hires_timer_available = FALSE;
|
||||
#ifdef __WINRT__
|
||||
start = 0; /* the timer failed to start! */
|
||||
#else
|
||||
timeSetPeriod(1); /* use 1 ms timer precision */
|
||||
start = timeGetTime();
|
||||
#endif /* ifdef __WINRT__ */
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __WINRT__
|
||||
SDL_AddHintCallback(SDL_HINT_TIMER_RESOLUTION,
|
||||
SDL_TimerResolutionChanged, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
Uint32
|
||||
|
|
@ -119,7 +127,11 @@ SDL_GetTicks(void)
|
|||
|
||||
return (DWORD) hires_now.QuadPart;
|
||||
} else {
|
||||
#ifdef __WINRT__
|
||||
now = 0;
|
||||
#else
|
||||
now = timeGetTime();
|
||||
#endif // ifdef __WINRT__
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -148,6 +160,19 @@ SDL_GetPerformanceFrequency(void)
|
|||
return frequency.QuadPart;
|
||||
}
|
||||
|
||||
#ifdef __WINRT__
|
||||
static void
|
||||
Sleep(DWORD timeout)
|
||||
{
|
||||
static HANDLE mutex = 0;
|
||||
if ( ! mutex )
|
||||
{
|
||||
mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
|
||||
}
|
||||
WaitForSingleObjectEx(mutex, timeout, FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
SDL_Delay(Uint32 ms)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue