Provides accurate timing for animations and frame pacing. More...
#include <timing.h>
Public Member Functions | |
float | Update () |
Update the timing manager (call once per frame) | |
float | GetDeltaTime () const |
Get the last frame's delta time in seconds. | |
float | GetFPS () const |
Get current FPS. | |
float | GetElapsedTime () const |
Get total elapsed time since first update. | |
void | Reset () |
Reset the timing state. | |
Static Public Member Functions | |
static TimingManager & | Get () |
Private Member Functions | |
TimingManager () | |
TimingManager (const TimingManager &)=delete | |
TimingManager & | operator= (const TimingManager &)=delete |
Private Attributes | |
uint64_t | frequency_ |
uint64_t | first_time_ |
uint64_t | last_time_ |
float | accumulated_time_ |
uint32_t | frame_count_ |
float | fps_ |
float | last_delta_time_ |
Provides accurate timing for animations and frame pacing.
This class solves the issue where ImGui::GetIO().DeltaTime only updates when events are processed (mouse movement, etc). It uses SDL's performance counter to provide accurate timing regardless of input events.
|
inlineprivate |
Definition at line 93 of file timing.h.
References accumulated_time_, first_time_, fps_, frame_count_, frequency_, last_delta_time_, and last_time_.
|
privatedelete |
|
inlinestatic |
Definition at line 20 of file timing.h.
Referenced by yaze::core::Controller::DoRender(), yaze::gui::BackgroundRenderer::RenderDockingBackground(), yaze::editor::WelcomeScreen::Show(), and yaze::editor::EditorManager::Update().
|
inline |
Update the timing manager (call once per frame)
Definition at line 29 of file timing.h.
References accumulated_time_, fps_, frame_count_, frequency_, last_delta_time_, and last_time_.
Referenced by yaze::core::Controller::DoRender(), and yaze::editor::EditorManager::Update().
|
inline |
Get the last frame's delta time in seconds.
Definition at line 60 of file timing.h.
References last_delta_time_.
Referenced by yaze::editor::WelcomeScreen::Show().
|
inline |
|
inline |
Get total elapsed time since first update.
Definition at line 74 of file timing.h.
References first_time_, frequency_, and last_time_.
|
inline |
Reset the timing state.
Definition at line 83 of file timing.h.
References accumulated_time_, first_time_, fps_, frame_count_, last_delta_time_, and last_time_.
|
privatedelete |
|
private |
Definition at line 103 of file timing.h.
Referenced by GetElapsedTime(), TimingManager(), and Update().
|
private |
Definition at line 104 of file timing.h.
Referenced by GetElapsedTime(), Reset(), and TimingManager().
|
private |
Definition at line 105 of file timing.h.
Referenced by GetElapsedTime(), Reset(), TimingManager(), and Update().
|
private |
Definition at line 106 of file timing.h.
Referenced by Reset(), TimingManager(), and Update().
|
private |
Definition at line 107 of file timing.h.
Referenced by Reset(), TimingManager(), and Update().
|
private |
|
private |
Definition at line 109 of file timing.h.
Referenced by GetDeltaTime(), Reset(), TimingManager(), and Update().