libdonut  2.3.2
Application framework for cross-platform game development in C++20
Public Attributes | List of all members
donut::application::TickInfo Struct Reference

Transient information about the current tick of an Application. More...

#include <donut/application/TickInfo.hpp>

Public Attributes

Time< float > tickInterval
 The average time, in seconds, that should elapse between each tick. More...
 
std::size_t processedTickCount
 Number of ticks that have been fully processed since the start of the application. More...
 
Time< float > processedTickTime
 The accumulated time, in seconds, of all ticks that had been processed since the start of the application at the beginning of the current tick. More...
 

Detailed Description

Transient information about the current tick of an Application.

Examples
example_game.cpp, and example_rectangle.cpp.

Member Data Documentation

◆ tickInterval

Time<float> donut::application::TickInfo::tickInterval

The average time, in seconds, that should elapse between each tick.

This is calculated as the reciprocal of the desired application tick rate, i.e. tickInterval = 1 / ApplicationOptions::tickRate, assuming the tick rate is positive. If not, the value will be 0.

The tick interval should be used as the time delta when updating physics, timers, etc. within a tick. This will ensure a fixed update interval, which generally results in more stable, predictable and consistent behavior compared to using a variable update interval, especially with regard to floating-point errors and numerical integration methods which may produce different results depending on the step size.

To achieve a higher perceived update rate for the user, some form of interpolation and/or extrapolation should be used in the variable-rate Application::display() callback in order to smooth out the result of the fixed-rate ticks when applicable.

Examples
example_game.cpp.

◆ processedTickCount

std::size_t donut::application::TickInfo::processedTickCount

Number of ticks that have been fully processed since the start of the application.

◆ processedTickTime

Time<float> donut::application::TickInfo::processedTickTime

The accumulated time, in seconds, of all ticks that had been processed since the start of the application at the beginning of the current tick.


The documentation for this struct was generated from the following file: