FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::TimeProvider Class Reference

Timeprovider is an utility providing time management functionality You can have hierarchy of time providers, whose multiplier can be changed independently. More...

#include <timeprovider.h>

+ Collaboration diagram for FIFE::TimeProvider:

Public Member Functions

 TimeProvider (TimeProvider *master)
 Constructor In case there there is no provider master, you can use NULL. More...
 
 ~TimeProvider ()
 
void setMultiplier (float multiplier)
 With multiplier, you can adjust the time speed. More...
 
float getMultiplier () const
 
float getTotalMultiplier () const
 
uint32_t getGameTime () const
 Returns current game ticks, already scaled. More...
 

Private Member Functions

double getPreciseGameTime () const
 Returns current game ticks, already scaled, more precise. More...
 

Private Attributes

TimeProviderm_master
 
float m_multiplier
 
double m_time_static
 
double m_time_scaled
 

Detailed Description

Timeprovider is an utility providing time management functionality You can have hierarchy of time providers, whose multiplier can be changed independently.

Changing providers upper in the hierarchy, changes also all subproviders with the same ratio

Definition at line 42 of file timeprovider.h.

Constructor & Destructor Documentation

FIFE::TimeProvider::TimeProvider ( TimeProvider master)
explicit

Constructor In case there there is no provider master, you can use NULL.

Definition at line 36 of file timeprovider.cpp.

References getGameTime(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_time_scaled, and m_time_static.

FIFE::TimeProvider::~TimeProvider ( )

Definition at line 42 of file timeprovider.cpp.

Member Function Documentation

uint32_t FIFE::TimeProvider::getGameTime ( ) const

Returns current game ticks, already scaled.

Definition at line 65 of file timeprovider.cpp.

References getPreciseGameTime().

Referenced by FIFE::Instance::getActionRuntime(), FIFE::Instance::getRuntime(), FIFE::Instance::processMovement(), TimeProvider(), and FIFE::Instance::update().

+ Here is the caller graph for this function:

float FIFE::TimeProvider::getMultiplier ( ) const
See also
setMultiplier. Returns mutliplier for this single provider

Definition at line 53 of file timeprovider.cpp.

References m_multiplier.

Referenced by FIFE::Instance::bindTimeProvider(), FIFE::Model::getTimeMultiplier(), FIFE::Instance::getTimeMultiplier(), and FIFE::Instance::InstanceActivity::update().

+ Here is the caller graph for this function:

double FIFE::TimeProvider::getPreciseGameTime ( ) const
private

Returns current game ticks, already scaled, more precise.

Definition at line 69 of file timeprovider.cpp.

References getPreciseGameTime(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_master, m_multiplier, m_time_scaled, and m_time_static.

Referenced by getGameTime(), getPreciseGameTime(), and setMultiplier().

+ Here is the caller graph for this function:

float FIFE::TimeProvider::getTotalMultiplier ( ) const
See also
setMultiplier. Returns mutliplier for whole chain of timeproviders E.g. if master has multiplier 2.0 and this has 0.5, end result = 1.0

Definition at line 57 of file timeprovider.cpp.

References getTotalMultiplier(), m_master, and m_multiplier.

Referenced by getTotalMultiplier(), and FIFE::Instance::getTotalTimeMultiplier().

+ Here is the caller graph for this function:

void FIFE::TimeProvider::setMultiplier ( float  multiplier)

With multiplier, you can adjust the time speed.

0.5 means time runs half as slow, while 2.0 means it runs twice as fast

Definition at line 44 of file timeprovider.cpp.

References getPreciseGameTime(), FIFE::TimeManager::getTime(), FIFE::DynamicSingleton< TimeManager >::instance(), m_master, m_multiplier, m_time_scaled, and m_time_static.

Referenced by FIFE::Instance::bindTimeProvider(), FIFE::Model::setTimeMultiplier(), and FIFE::Instance::setTimeMultiplier().

+ Here is the caller graph for this function:

Member Data Documentation

TimeProvider* FIFE::TimeProvider::m_master
private

Definition at line 69 of file timeprovider.h.

Referenced by getPreciseGameTime(), getTotalMultiplier(), and setMultiplier().

float FIFE::TimeProvider::m_multiplier
private
double FIFE::TimeProvider::m_time_scaled
private

Definition at line 71 of file timeprovider.h.

Referenced by getPreciseGameTime(), setMultiplier(), and TimeProvider().

double FIFE::TimeProvider::m_time_static
private

Definition at line 71 of file timeprovider.h.

Referenced by getPreciseGameTime(), setMultiplier(), and TimeProvider().


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