Struct Demeter::Time

Nested Relationships

This struct is a nested type of Struct Demeter.

Struct Documentation

struct Time

Manages timing information using SDL2 for frame updates.

The Time struct encapsulates timing data, including the last and current tick counts, as well as the delta time between updates. It provides methods to update and retrieve timing information, which is useful for frame-based logic and animations.

Public Functions

Time() = default

Constructs a Time object and initializes its time tracking members.

This constructor initializes the Time object by capturing the current tick count from the provided SDL2 instance. Both the ‘last’ and ‘current’ members are set to the value returned by SDL2::GetTicks64(), ensuring that time tracking starts from the same reference point.

Parameters:

sdl2Instance – Reference to an SDL2 object used to obtain the current tick count.

inline Time(const SDL2 &sdl2Instance)
void Update(const SDL2 &sdl2Instance)

Updates the delta time using the provided SDL2 instance.

Parameters:

sdl2Instance – Reference to an SDL2 instance used for rendering or event handling.

inline Uint64 GetLast() const
inline Uint64 GetCurrent() const
inline double GetDelta() const