瀏覽代碼

rcore_platform_sdl: Fix `GetTime()` resolution for sdl

`SDL_GetTicks()` only has millisecond resolution so switched to
`SLD_GetPerformanceCounter()` combined with
`SDL_GetPerformanceFrequency()` which should allow more granular timing
pull/5653/head
Soma Mizobuchi 1 天之前
父節點
當前提交
ce5cebe999
共有 1 個檔案被更改,包括 1 行新增2 行删除
  1. +1
    -2
      src/platforms/rcore_desktop_sdl.c

+ 1
- 2
src/platforms/rcore_desktop_sdl.c 查看文件

@ -1276,8 +1276,7 @@ void SwapScreenBuffer(void)
// Get elapsed time measure in seconds
double GetTime(void)
{
unsigned int ms = SDL_GetTicks(); // Elapsed time in milliseconds since SDL_Init()
double time = (double)ms/1000;
double time = (double)SDL_GetPerformanceCounter() / (double)SDL_GetPerformanceFrequency();
return time;
}

Loading…
取消
儲存