#pragma once #include "Common/Pure.hpp" #include "Common/Sizes.hpp" namespace MC { class Time { public: using Timestamp = U64; using Tick = U64; Time() = default; void start_frame(); void end_frame(); // The total number of frames that have been rendered. // Starts at 1, with 0 being reserved as the empty value. PURE U64 total_frames() const; // The current frame number. // Starts at 1, with 0 being reserved as the empty value. // This is the same as total_frames(), but is more descriptive, sometimes. // :) PURE Tick tick() const; PURE Real delta() const; PURE Timestamp frame_start() const; static Timestamp now(); private: static constexpr Real delta_max = 1.0 / 10.0; static constexpr Real delta_min = 1.0 / 1000.0; U64 m_total_frames = 1; Timestamp m_current_frame_start = 0; Real m_delta = 0; }; }