Added high resolution timing API: SDL_GetPerformanceCounter(), SDL_GetPerformanceFrequency()
This commit is contained in:
parent
98e5ddb37d
commit
85ad17e7d6
8 changed files with 127 additions and 1 deletions
|
@ -99,6 +99,28 @@ SDL_GetTicks(void)
|
|||
return (ticks);
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_GetPerformanceCounter(void)
|
||||
{
|
||||
LARGE_INTEGER counter;
|
||||
|
||||
if (!QueryPerformanceCounter(&counter)) {
|
||||
return SDL_GetTicks();
|
||||
}
|
||||
return counter.QuadPart;
|
||||
}
|
||||
|
||||
Uint64
|
||||
SDL_GetPerformanceFrequency(void)
|
||||
{
|
||||
LARGE_INTEGER frequency;
|
||||
|
||||
if (!QueryPerformanceFrequency(&frequency)) {
|
||||
return 1000;
|
||||
}
|
||||
return frequency.QuadPart;
|
||||
}
|
||||
|
||||
void
|
||||
SDL_Delay(Uint32 ms)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue