Toast Engine
Loading...
Searching...
No Matches
Time Class Referencefinal

Class that controls the time of the application. More...

#include <time.hpp>

Public Member Functions

 Time (const Time &)=delete
auto operator= (const Time &) -> Time &=delete
 Time (Time &&)=delete
auto operator= (Time &&) -> Time &=delete
void tick () noexcept
 Updates the main thread clock.
void renderTick () noexcept
 Updates the render thread clock.

Static Public Member Functions

static auto get () noexcept -> Time &
static auto delta () noexcept -> double
static auto rawDelta () noexcept -> double
static auto renderDelta () noexcept -> double
static auto frame () noexcept -> uint64_t
static auto renderFrame () noexcept -> uint64_t
static auto snapshot () noexcept -> TimeSnapshot
static auto scale () noexcept -> double
static void scale (double value)
 Sets the timescale multiplier.
static void pause () noexcept
 Pauses simulation time.
static void resume () noexcept
 Resumes simulation time.
static auto paused () noexcept -> bool
static auto tps () noexcept -> double
static auto fps () noexcept -> double
static auto uptime () noexcept -> double
static auto system () noexcept -> double
static void setMaxDelta (double delta)
 Sets the maximum delta the simulation will report.

Friends

struct toast::Engine

Detailed Description

Class that controls the time of the application.

Use delta() for time reads

Use snapshot() when you need a consistent view of multiple fields for a full system tick

Member Function Documentation

◆ delta()

auto Time::delta ( ) -> double
staticnoexcept
Returns
Time the last World::tick() took
Here is the caller graph for this function:

◆ fps()

auto Time::fps ( ) -> double
staticnoexcept
Returns
Render frames per second

◆ frame()

auto Time::frame ( ) -> uint64_t
staticnoexcept
Returns
Simulation frame counter

◆ get()

auto Time::get ( ) -> Time &
staticnoexcept
Returns
Time instance

◆ paused()

auto Time::paused ( ) -> bool
staticnoexcept
Returns
Whether simulation time is paused

◆ rawDelta()

auto Time::rawDelta ( ) -> double
staticnoexcept
Returns
delta() without time scaling

◆ renderDelta()

auto Time::renderDelta ( ) -> double
staticnoexcept
Returns
Time the last render frame took

◆ renderFrame()

auto Time::renderFrame ( ) -> uint64_t
staticnoexcept
Returns
Render frame counter

◆ scale()

auto Time::scale ( ) -> double
staticnoexcept
Returns
Current time scale multiplier

◆ snapshot()

auto Time::snapshot ( ) -> TimeSnapshot
staticnoexcept
Returns
Consistent snapshot of all time values

◆ system()

auto Time::system ( ) -> double
staticnoexcept
Returns
System clock as seconds since epoch

◆ tps()

auto Time::tps ( ) -> double
staticnoexcept
Returns
Simulation ticks per second

◆ uptime()

auto Time::uptime ( ) -> double
staticnoexcept
Returns
Live seconds since application start
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • engine/src/toast/time.hpp
  • engine/src/toast/time.cpp