diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/time.cpp | 5 | ||||
-rw-r--r-- | src/utils/time.h | 7 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/utils/time.cpp b/src/utils/time.cpp index c89914fa..df20fc23 100644 --- a/src/utils/time.cpp +++ b/src/utils/time.cpp @@ -41,6 +41,11 @@ unsigned deltaTimeMs() return s_deltaTimeMs; } +float deltaTime() +{ + return s_deltaTimeMs / 1000.f; +} + static int32_t getElapsedTime(uint32_t timeMs) { return static_cast<int32_t>(s_absoluteTimeMs - timeMs); diff --git a/src/utils/time.h b/src/utils/time.h index ac7cd351..58b8164a 100644 --- a/src/utils/time.h +++ b/src/utils/time.h @@ -39,11 +39,16 @@ namespace Time uint32_t absoluteTimeMs(); /** - * The time in milliseconds since the last frame, maximized to 1000ms. + * The time in milliseconds since the last frame, but never more than 1000. */ unsigned deltaTimeMs(); /** + * The time in seconds since the last frame, but never more than 1. + */ +float deltaTime(); + +/** * Called at the start of each frame, updates the above variables. */ void beginFrame(); |