Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.11 KB

File metadata and controls

49 lines (36 loc) · 1.11 KB

TimestepManager

Code: include/core/TimestepManager.hpp, src/core/TimestepManager.cpp

Overview

TimestepManager owns fixed-update timing plus render cadence handling. This branch adds explicit display refresh propagation through:

setDisplayRefreshHz(float hz);

The fixed simulation rate remains unchanged; refresh-rate input is used to better quantize VSync-paced render deltas.

Core Loop

startFrame();
while (shouldUpdate()) {
    update(getUpdateDeltaTime());
}
if (shouldRender()) {
    render(getInterpolationAlpha());
}
endFrame();

Key APIs

setTargetFPS(float fps);
setFixedTimestep(float timestep);
setDisplayRefreshHz(float hz);
setSoftwareFrameLimiting(bool enabled);
reset();

Useful accessors:

getCurrentFPS()
getFrameTimeMs()
getInterpolationAlpha()
isFrameTimeExcessive()

Why Refresh Propagation Matters

On high-refresh or variable-refresh displays, the real display cadence may differ from the nominal target FPS. Feeding the active refresh rate into TimestepManager reduces drift and micro-jitter without changing gameplay update frequency.