diff --git a/include/blah/time.h b/include/blah/time.h index e870495..937a4cd 100644 --- a/include/blah/time.h +++ b/include/blah/time.h @@ -8,10 +8,10 @@ namespace Blah // ticks per second (microseconds, in this case) constexpr u64 ticks_per_second = 1000000; - // uptime, in ticks + // uptime, in ticks, at the start of the current frame extern u64 ticks; - // uptime, in seconds + // uptime, in seconds, at the start of the current frame extern double seconds; // delta time from last frame @@ -26,6 +26,9 @@ namespace Blah // time the application should pause for extern float pause_timer; + // uptime, in ticks. polls the Platform for an immediate value, unlike the cached `Time::ticks` value + u64 get_ticks(); + // pauses the entire application for the given time void pause_for(float duration); diff --git a/src/time.cpp b/src/time.cpp index 569990e..6843fc2 100644 --- a/src/time.cpp +++ b/src/time.cpp @@ -10,6 +10,11 @@ double Time::previous_seconds = 0; float Time::delta = 0; float Time::pause_timer = 0; +u64 Time::get_ticks() +{ + return Platform::ticks(); +} + void Time::pause_for(float duration) { if (duration >= pause_timer)