Cogs.Core
Public Member Functions | Private Attributes | List of all members
Cogs::Core::Time Class Reference

Provides time services for components depending on elapsed or system time for animation or other tracking. More...

#include <Time.h>

Public Member Functions

 Time (class Context *context)
 
void setAnimationTime (double value)
 Set the global animation time to the given value.
 
double getAnimationTime ()
 Gets the current animation time in seconds.
 
double getAnimationTimeDelta ()
 Get the time elapsed since the previous frame.
 
uint32_t getFrame ()
 Get the current frame number.
 
void update ()
 Updates the state of the time service.
 
TimerrefDeltaTime ()
 Return a non-const reference to the delta timer.
 

Private Attributes

Contextcontext = nullptr
 
double animationTime = 0.0
 
double animationTimeDelta = 0.0
 
uint32_t frame = 0
 
Timer timer
 
Timer timeDelta
 

Detailed Description

Provides time services for components depending on elapsed or system time for animation or other tracking.

Definition at line 15 of file Time.h.

Constructor & Destructor Documentation

◆ Time()

Cogs::Core::Time::Time ( class Context context)

Definition at line 7 of file Time.cpp.

Member Function Documentation

◆ getAnimationTime()

double Cogs::Core::Time::getAnimationTime ( )

Gets the current animation time in seconds.

Definition at line 20 of file Time.cpp.

References getAnimationTime().

Referenced by getAnimationTime().

◆ getAnimationTimeDelta()

double Cogs::Core::Time::getAnimationTimeDelta ( )
inline

Get the time elapsed since the previous frame.

Definition at line 35 of file Time.h.

◆ getFrame()

uint32_t Cogs::Core::Time::getFrame ( )
inline

Get the current frame number.

Definition at line 40 of file Time.h.

◆ refDeltaTime()

Timer & Cogs::Core::Time::refDeltaTime ( )
inline

Return a non-const reference to the delta timer.

Use this to read and change the scale of the delta timer.

Definition at line 55 of file Time.h.

◆ setAnimationTime()

void Cogs::Core::Time::setAnimationTime ( double  value)

Set the global animation time to the given value.

The time is given in seconds.

Definition at line 15 of file Time.cpp.

References setAnimationTime().

Referenced by setAnimationTime().

◆ update()

void Cogs::Core::Time::update ( )

Updates the state of the time service.

If automatic time updates are enabled, the animationTime field will be updated to reflect the time elapsed since the service started.

Definition at line 25 of file Time.cpp.

References update().

Referenced by update().

Member Data Documentation

◆ animationTime

double Cogs::Core::Time::animationTime = 0.0
private

Definition at line 60 of file Time.h.

◆ animationTimeDelta

double Cogs::Core::Time::animationTimeDelta = 0.0
private

Definition at line 61 of file Time.h.

◆ context

Context* Cogs::Core::Time::context = nullptr
private

Definition at line 58 of file Time.h.

◆ frame

uint32_t Cogs::Core::Time::frame = 0
private

Definition at line 62 of file Time.h.

◆ timeDelta

Timer Cogs::Core::Time::timeDelta
private

Definition at line 65 of file Time.h.

◆ timer

Timer Cogs::Core::Time::timer
private

Definition at line 64 of file Time.h.


The documentation for this class was generated from the following files: