Nebula
Loading...
Searching...
No Matches
Game::TimeManager Namespace Reference

Detailed Description

Singleton object which manages the current game time.

These are the standard time source objects provided by Application layer:

TIMESOURCE_SYSTEM - timing for low level Application layer subsystems TIMESOURCE_GAMEPLAY - timing for the game logic TIMESOURCE_INPUT - extra time source for input handling

Each time source tracks its own time independently from the other time sources, they can also be paused and unpaused independentlty from each other, and they may also run faster or slower then realtime.

You can create custom time sources by using the create interface.

Todo
Thread safety

Classes

struct  State
 timemanager singleton state More...
 
struct  TimeSourceState
 This struct needs to be structured exactly like the TimeSource struct, just with different qualifiers. More...
 

Functions

void Destroy ()
 Destroy the singleton.
 
void OnActivate ()
 called after create
 
void OnBeginFrame ()
 called at beginning of each frame
 
Game::ManagerAPI Create ()
 create the singleton
 
TimeSource *const CreateTimeSource (TimeSourceCreateInfo const &info)
 create a timesource. The global time manager handles the timesources.
 
TimeSource *const GetTimeSource (uint32_t TIMESOURCE_HASH)
 get a time source by hash
 
void SetGlobalTimeFactor (float factor)
 set global time scale. This should be used sparingly. You can usually set individual time sources time factor instead.
 
float GetGlobalTimeFactor ()
 get the global time scale
 

Variables

static Statestate = nullptr
 

Function Documentation

◆ Create()

Game::ManagerAPI Game::TimeManager::Create ( )

create the singleton

◆ CreateTimeSource()

TimeSource *const Game::TimeManager::CreateTimeSource ( TimeSourceCreateInfo const & info)

create a timesource. The global time manager handles the timesources.

◆ Destroy()

void Game::TimeManager::Destroy ( )

Destroy the singleton.

◆ GetGlobalTimeFactor()

float Game::TimeManager::GetGlobalTimeFactor ( )

get the global time scale

◆ GetTimeSource()

TimeSource *const Game::TimeManager::GetTimeSource ( uint32_t TIMESOURCE_HASH)

get a time source by hash

◆ OnActivate()

void Game::TimeManager::OnActivate ( )

called after create

◆ OnBeginFrame()

void Game::TimeManager::OnBeginFrame ( )

called at beginning of each frame

◆ SetGlobalTimeFactor()

void Game::TimeManager::SetGlobalTimeFactor ( float factor)

set global time scale. This should be used sparingly. You can usually set individual time sources time factor instead.

Variable Documentation

◆ state

State* Game::TimeManager::state = nullptr
static