diff options
author | 2016-11-16 16:26:13 +0100 | |
---|---|---|
committer | 2016-11-16 16:28:01 +0100 | |
commit | 47a05778bff9388fc6c479461dd3804c79d7b539 (patch) | |
tree | bb3d4dc8df676b8aa478339b3fd0cd305dc4ac4d /3rdparty/SDL2/Xcode-iOS/Demos/src/common.c | |
parent | e61b392edfbfe5b9d70908c087632da915a3abd8 (diff) |
Updated SDL2 to 2.0.5 (nw)
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; +} |