SaturnRingLibrary 0.9.2
SGL wrapper
Loading...
Searching...
No Matches

◆ DeltaSeconds()

const Math::Types::Fxp & SRL::Timer::DeltaSeconds ( )
inlinestaticnoexcept

Frame delta time in seconds (fixed-point 16.16).

Pre-calculated each frame by Core::Synchronize(). Represents the time elapsed between the current frame and the previous frame, in seconds.

Range:
  • Typical 60fps: ~0.0167 seconds (16.7ms)
  • Typical 30fps: ~0.0333 seconds (33.3ms)
  • Fxp limit: 32767 seconds (~9.1 hours)
Hardware vs Fxp Limit:
The hardware timer can track up to ~673 days, but DeltaSeconds returns Fxp which has a hard limit of 32767. For game frames this is never an issue.
Usage:
Use for frame-rate independent animation, physics updates, and game logic. Multiply by velocity values to get distance traveled this frame.
// Move object at constant speed regardless of frame rate
Fxp speed = 100.0; // 100 units per second
position = position + speed * Timer::DeltaSeconds();
static const Math::Types::Fxp & DeltaSeconds() noexcept
Frame delta time in seconds (fixed-point 16.16).
Definition srl_timer.hpp:983
See also
DeltaMilliseconds() for millisecond precision