mirror of
https://github.com/aap/librw.git
synced 2024-11-27 14:15:41 +00:00
Merge pull request #91 from madebr/sdl2_imgui_percounter
skeleton: use SDL_GetPerformanceCounter instead of SDL_GetTicks
This commit is contained in:
commit
8dbe79bcd2
@ -224,7 +224,8 @@ main(int argc, char *argv[])
|
|||||||
if(EventHandler(RWINITIALIZE, nil) == EVENTERROR)
|
if(EventHandler(RWINITIALIZE, nil) == EVENTERROR)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
float lastTime = SDL_GetTicks();
|
Uint64 lastTicks = SDL_GetPerformanceCounter();
|
||||||
|
const float tickPeriod = 1.f / SDL_GetPerformanceFrequency();
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
int mouseButtons = 0;
|
int mouseButtons = 0;
|
||||||
|
|
||||||
@ -297,12 +298,12 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float currTime = SDL_GetTicks();
|
Uint64 currTicks = SDL_GetPerformanceCounter();
|
||||||
float timeDelta = (currTime - lastTime) * 0.001f;
|
float timeDelta = (currTicks - lastTicks) * tickPeriod;
|
||||||
|
|
||||||
EventHandler(IDLE, &timeDelta);
|
EventHandler(IDLE, &timeDelta);
|
||||||
|
|
||||||
lastTime = currTime;
|
lastTicks = currTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_StopTextInput();
|
SDL_StopTextInput();
|
||||||
|
Loading…
Reference in New Issue
Block a user