diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/CMakeLists.txt | 1 | ||||
-rw-r--r-- | engine/include/kurator/engine/Clock.h | 20 | ||||
-rw-r--r-- | engine/src/Clock.cpp | 33 |
3 files changed, 54 insertions, 0 deletions
diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 1ffbd98..7cb7f20 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -2,6 +2,7 @@ project(engine) add_library( ${PROJECT_NAME} STATIC src/Camera.cpp + src/Clock.cpp src/Point.cpp ) target_include_directories( diff --git a/engine/include/kurator/engine/Clock.h b/engine/include/kurator/engine/Clock.h new file mode 100644 index 0000000..4e5e7b1 --- /dev/null +++ b/engine/include/kurator/engine/Clock.h @@ -0,0 +1,20 @@ +#pragma once + + +namespace kurator +{ +namespace engine +{ + + +struct Clock +{ + float time_factor = 1.0f; + float dt() const; + float ui() const; + operator float() const; +}; + + +} // namespace engine +} // namespace kurator diff --git a/engine/src/Clock.cpp b/engine/src/Clock.cpp new file mode 100644 index 0000000..5261603 --- /dev/null +++ b/engine/src/Clock.cpp @@ -0,0 +1,33 @@ +#include <kurator/engine/Clock.h> + +#include <raylib.h> + + +namespace kurator +{ +namespace engine +{ + + +float +Clock::dt() const +{ + return GetFrameTime() * time_factor; +} + + +float +Clock::ui() const +{ + return GetFrameTime(); +} + + +Clock::operator float() const +{ + return dt(); +} + + +} // namespace engine +} // namespace kurator |