void
SDL_Delay(Uint32 ms)
{
/*
早期版本的WinRT操作系统不允许程序直接访问Sleep函数,所以早期的实现方式是通过信号量的等待来解决睡眠问题
Visual C++ 2013 Update 4在Windows8.1和Windows Phone8.1上重新定义了Sleep函数*/
#if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723)
static HANDLE mutex = 0;
if (!mutex) {
mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS);
}
WaitForSingleObjectEx(mutex, ms, FALSE);
#else
if (!ticks_started) {
SDL_TicksInit();
}
Sleep(ms);
#endif
}