Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::Timestep Class Reference

Represents a time step in seconds. More...

#include <timestep.hpp>

Public Member Functions

constexpr Timestep () noexcept=default
 Default constructor, initializes time step to 0.
 
constexpr Timestep (float time) noexcept
 Constructs a Timestep with the given time in seconds.
 
constexpr Timestep (const Timestep &) noexcept=default
 
constexpr Timestep (Timestep &&) noexcept=default
 
constexpr ~Timestep () noexcept=default
 
constexpr Timestepoperator= (const Timestep &) noexcept=default
 
constexpr Timestepoperator= (Timestep &&) noexcept=default
 
constexpr operator float () const noexcept
 
constexpr float Sec () const noexcept
 Gets the time step in seconds.
 
constexpr float MilliSec () const noexcept
 Gets the time step in milliseconds.
 
constexpr float Framerate () const noexcept
 Gets the framerate corresponding to the time step.
 

Detailed Description

Represents a time step in seconds.

Provides utility functions to convert to milliseconds and framerate.

Definition at line 9 of file timestep.hpp.

Constructor & Destructor Documentation

◆ Timestep() [1/4]

constexpr helios::Timestep::Timestep ( )
constexprdefaultnoexcept

Default constructor, initializes time step to 0.

◆ Timestep() [2/4]

constexpr helios::Timestep::Timestep ( float  time)
inlineexplicitconstexprnoexcept

Constructs a Timestep with the given time in seconds.

Parameters
timeTime in seconds.

Definition at line 20 of file timestep.hpp.

20: time_(time) {}

◆ Timestep() [3/4]

constexpr helios::Timestep::Timestep ( const Timestep )
constexprdefaultnoexcept

◆ Timestep() [4/4]

constexpr helios::Timestep::Timestep ( Timestep &&  )
constexprdefaultnoexcept

◆ ~Timestep()

constexpr helios::Timestep::~Timestep ( )
constexprdefaultnoexcept

Member Function Documentation

◆ Framerate()

constexpr float helios::Timestep::Framerate ( ) const
inlineconstexprnoexcept

Gets the framerate corresponding to the time step.

Returns
Framerate (frames per second).

Definition at line 46 of file timestep.hpp.

46{ return 1.0F / time_; }

◆ MilliSec()

constexpr float helios::Timestep::MilliSec ( ) const
inlineconstexprnoexcept

Gets the time step in milliseconds.

Returns
Time step in milliseconds.

Definition at line 40 of file timestep.hpp.

40{ return time_ * 1000.0F; }

◆ operator float()

constexpr helios::Timestep::operator float ( ) const
inlineexplicitconstexprnoexcept

Definition at line 28 of file timestep.hpp.

28{ return time_; }

◆ operator=() [1/2]

constexpr Timestep & helios::Timestep::operator= ( const Timestep )
constexprdefaultnoexcept

◆ operator=() [2/2]

constexpr Timestep & helios::Timestep::operator= ( Timestep &&  )
constexprdefaultnoexcept

◆ Sec()

constexpr float helios::Timestep::Sec ( ) const
inlineconstexprnoexcept

Gets the time step in seconds.

Returns
Time step in seconds.

Definition at line 34 of file timestep.hpp.

34{ return time_; }