diff options
Diffstat (limited to '3rdparty/SDL2/Xcode-iOS/Demos/src/common.c')
-rw-r--r-- | 3rdparty/SDL2/Xcode-iOS/Demos/src/common.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/3rdparty/SDL2/Xcode-iOS/Demos/src/common.c b/3rdparty/SDL2/Xcode-iOS/Demos/src/common.c index b2d96345669..0a1485ae926 100644 --- a/3rdparty/SDL2/Xcode-iOS/Demos/src/common.c +++ b/3rdparty/SDL2/Xcode-iOS/Demos/src/common.c @@ -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; +} |