VSync - detecting missed frames |
Ya |
trevor.shawn.williams
|
Should probably make your animation time based instead of frame based.
"No matter how many frames are displayed per second, the character can only move this much in a second". Should result in consistent animation across many systems. Ive seen a lot of people pull it off with SDL_GetTicks measuring HINT ==> Delta Time <== HINT, but if you're worried about accuracy, try C++11s <chrono>. I haven't done a side by side with it and SDL, but I've heard just as many good things about it as I have about SDLs timing mechanisms. It could be better, but it won't be worse...if either is bad at all. |
|||||||||||
|
PawelS
|
Thanks, my tests show that the SDL_GetTicks function is quite accurate (so there's no need to use <chrono>), my assumption that it isn't was caused by my experiences with SDL 1.2 some time ago, where I tried to create my own VSync, as it wasn't available as a part of SDL, like it is now. I did it by counting the number of milliseconds before refreshing the screen, but it didn't work well. But in SDL2 it seems to be accurate enough to count the number of frames that passed.
|
|||||||||||
|