23 #ifdef SDL_TIMER_WINDOWS
25 #include "../../core/windows/SDL_windows.h"
36 #ifndef USE_GETTICKCOUNT
38 static BOOL hires_timer_available;
40 static LARGE_INTEGER hires_start_ticks;
42 static LARGE_INTEGER hires_ticks_per_second;
46 timeSetPeriod(
UINT uPeriod)
48 static UINT timer_period = 0;
50 if (uPeriod != timer_period) {
52 timeEndPeriod(timer_period);
55 timer_period = uPeriod;
58 timeBeginPeriod(timer_period);
64 SDL_TimerResolutionChanged(
void *userdata,
const char *
name,
const char *oldValue,
const char *hint)
74 if (uPeriod || oldValue != hint) {
75 timeSetPeriod(uPeriod);
88 #ifdef USE_GETTICKCOUNT
89 start = GetTickCount();
94 if (QueryPerformanceFrequency(&hires_ticks_per_second) ==
TRUE) {
95 hires_timer_available =
TRUE;
96 QueryPerformanceCounter(&hires_start_ticks);
98 hires_timer_available =
FALSE;
105 SDL_TimerResolutionChanged,
NULL);
112 #ifndef USE_GETTICKCOUNT
113 LARGE_INTEGER hires_now;
120 #ifdef USE_GETTICKCOUNT
121 now = GetTickCount();
123 if (hires_timer_available) {
124 QueryPerformanceCounter(&hires_now);
126 hires_now.QuadPart -= hires_start_ticks.QuadPart;
127 hires_now.QuadPart *= 1000;
128 hires_now.QuadPart /= hires_ticks_per_second.QuadPart;
130 return (
DWORD) hires_now.QuadPart;
136 return (now -
start);
144 if (!QueryPerformanceCounter(&counter)) {
147 return counter.QuadPart;
153 LARGE_INTEGER frequency;
155 if (!QueryPerformanceFrequency(&frequency)) {
158 return frequency.QuadPart;
static SDL_bool ticks_started
EGLImageKHR EGLint * name
DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata)
#define SDL_HINT_TIMER_RESOLUTION
A variable that controls the timer resolution, in milliseconds.
typedef UINT(WINAPI *PFNWGLGETCONTEXTGPUIDAMDPROC)(HGLRC hglrc)
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC Uint32 SDLCALL SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
uint64_t Uint64
An unsigned 64-bit integer type.
DECLSPEC Uint64 SDLCALL SDL_GetPerformanceCounter(void)
Get the current value of the high resolution counter.
DECLSPEC void SDLCALL SDL_Delay(Uint32 ms)
Wait a specified number of milliseconds before returning.
DECLSPEC int SDLCALL SDL_atoi(const char *str)
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
DECLSPEC Uint64 SDLCALL SDL_GetPerformanceFrequency(void)
Get the count per second of the high resolution counter.
typedef BOOL(WINAPI *PFNWGLSETSTEREOEMITTERSTATE3DLPROC)(HDC hDC