Helios Engine
A modular ECS based data-oriented C++23 game engine framework
Loading...
Searching...
No Matches

Configuration for fixed-timestep runners. More...

#include <runners.hpp>

Static Public Member Functions

static constexpr auto FromFPS (size_t fps) noexcept -> FixedRunnerConfig
 Creates a config targeting the given frames per second.
static constexpr auto FromHz (double hz) noexcept -> FixedRunnerConfig
 Creates a config targeting the given update frequency in Hz.
template<typename Rep, typename Period>
static constexpr auto FromInterval (std::chrono::duration< Rep, Period > interval) noexcept -> FixedRunnerConfig
 Creates a config with the given update interval.

Public Attributes

std::chrono::nanoseconds update_interval = kDefaultInterval
 Time to wait between the start of consecutive updates.

Static Public Attributes

static constexpr auto kDefaultInterval

Detailed Description

Configuration for fixed-timestep runners.

Definition at line 14 of file runners.hpp.

Member Function Documentation

◆ FromFPS()

constexpr auto helios::app::FixedRunnerConfig::FromFPS ( size_t fps) -> FixedRunnerConfig
inlinestaticnodiscardconstexprnoexcept

Creates a config targeting the given frames per second.

Parameters
fpsTarget frames per second (must be > 0)
Returns
FixedRunnerConfig with the corresponding update interval

Definition at line 26 of file runners.hpp.

◆ FromHz()

constexpr auto helios::app::FixedRunnerConfig::FromHz ( double hz) -> FixedRunnerConfig
inlinestaticnodiscardconstexprnoexcept

Creates a config targeting the given update frequency in Hz.

Parameters
hzTarget frequency in Hz (must be > 0)
Returns
FixedRunnerConfig with the corresponding update interval

Definition at line 37 of file runners.hpp.

◆ FromInterval()

template<typename Rep, typename Period>
constexpr auto helios::app::FixedRunnerConfig::FromInterval ( std::chrono::duration< Rep, Period > interval) -> FixedRunnerConfig
inlinestaticnodiscardconstexprnoexcept

Creates a config with the given update interval.

Template Parameters
RepDuration representation type
PeriodDuration period type
Parameters
intervalUpdate interval as a std::chrono::duration
Returns
FixedRunnerConfig with the given interval

Definition at line 52 of file runners.hpp.

Member Data Documentation

◆ kDefaultInterval

auto helios::app::FixedRunnerConfig::kDefaultInterval
staticconstexpr
Initial value:
=
std::chrono::nanoseconds{16'666'667}

Definition at line 15 of file runners.hpp.

◆ update_interval

std::chrono::nanoseconds helios::app::FixedRunnerConfig::update_interval = kDefaultInterval

Time to wait between the start of consecutive updates.

Definition at line 19 of file runners.hpp.