Update the code for the iOS demos to handle modern devices. Fixes bug #3337

This commit is contained in:
Alex Szpakowski 2016-09-25 00:23:35 -03:00
parent 40ecac8e60
commit a8b033d7c4
12 changed files with 233 additions and 143 deletions

View file

@ -32,5 +32,25 @@ void
fatalError(const char *string)
{
printf("%s: %s\n", string, SDL_GetError());
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, string, SDL_GetError(), NULL);
exit(1);
}
static Uint64 prevTime = 0;
double
updateDeltaTime()
{
Uint64 curTime;
double deltaTime;
if (prevTime == 0) {
prevTime = SDL_GetPerformanceCounter();
}
curTime = SDL_GetPerformanceCounter();
deltaTime = (double) (curTime - prevTime) / (double) SDL_GetPerformanceFrequency();
prevTime = curTime;
return deltaTime;
}