Nebula
Loading...
Searching...
No Matches
timemanager.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
25//------------------------------------------------------------------------------
26#include "core/singleton.h"
27#include "game/manager.h"
28#include "timing/time.h"
29
30#define TIMESOURCE_GAMEPLAY uint32_t('GPTS')
31#define TIMESOURCE_INPUT uint32_t('IPTS')
32#define TIMESOURCE_SYSTEM uint32_t('SYTS')
33
34namespace Game
35{
36
37//------------------------------------------------------------------------------
42{
44 uint32_t hash = 0;
45};
46
47//------------------------------------------------------------------------------
66
67//------------------------------------------------------------------------------
70namespace Time
71{
74
76 TimeSource* const GetTimeSource(uint32_t TIMESOURCE_HASH);
77
79 void SetGlobalTimeFactor(float factor);
80
83};
84
85//------------------------------------------------------------------------------
89{
92public:
94 virtual ~TimeManager();
95
96 void OnActivate() override;
97 void OnDeactivate() override;
98 void OnBeginFrame() override;
99};
100
101} // namespace Game
Definition manager.h:32
Definition timemanager.h:89
void OnBeginFrame() override
called before frame by the feature
Definition timemanager.cc:168
void OnDeactivate() override
called when removed from game server
Definition timemanager.cc:157
void OnActivate() override
Definition timemanager.cc:120
TimeSource *const CreateTimeSource(TimeSourceCreateInfo const &info)
create a timesource. The global time manager handles the timesources.
void SetGlobalTimeFactor(float factor)
set global time scale. This should be used sparingly. You can usually set individual time sources tim...
TimeSource *const GetTimeSource(uint32_t TIMESOURCE_HASH)
get a time source by hash
float GetGlobalTimeFactor()
get the global time scale
Game::EditorState.
Definition orientation.h:7
int Tick
the tick datatype (one tick == 1 millisecond)
Definition time.h:20
double Time
the time datatype
Definition time.h:18
#define __DeclareSingleton(type)
Definition osxsingleton.h:24
#define __DeclareClass(type)
Used to create a timesource.
Definition timemanager.h:42
uint32_t hash
time source hash number. Ex. 'ABC1'
Definition timemanager.h:44
A generic time source POD struct which is created and deleted by the TimeManager.
Definition timemanager.h:54
float timeFactor
time factor for this time source
Definition timemanager.h:64
Timing::Time const time
total time this timesource has run for
Definition timemanager.h:58
int pauseCounter
increment this to pause time, decrement to continue running
Definition timemanager.h:62
Timing::Time const frameTime
delta time between this frame and last frame
Definition timemanager.h:56
Timing::Tick const ticks
number of ticks that this time source has run for
Definition timemanager.h:60
Typedefs for the Timing subsystem.