Cogs.Core
Time.cpp
1#include "Time.h"
2
3#include "Context.h"
4
5#include "Variables.h"
6
7Cogs::Core::Time::Time(class Context * context) :
8 context(context)
9{
10 timer.start();
11 timeDelta.start();
12 frame = 0;
13}
14
16{
17 animationTime = value;
18}
19
21{
22 return animationTime;
23}
24
26{
27 if (context->variables->get("time.automatic", true)) {
28 animationTime = timer.elapsedSeconds();
29 }
30 animationTimeDelta = timeDelta.elapsedSeconds();
31 timeDelta.start();
32
33 frame++;
34}
void update()
Updates the state of the time service.
Definition: Time.cpp:25
void setAnimationTime(double value)
Set the global animation time to the given value.
Definition: Time.cpp:15
double getAnimationTime()
Gets the current animation time in seconds.
Definition: Time.cpp:20