FIFE  6e1afdbeda11afe9ac53e6023a4be96ef88f1dc6
FIFE::TimeManager Class Reference

Time Manager. More...

#include <timemanager.h>

+ Inheritance diagram for FIFE::TimeManager:
+ Collaboration diagram for FIFE::TimeManager:

Public Member Functions

 TimeManager ()
 Default constructor. More...
 
virtual ~TimeManager ()
 Destructor. More...
 
void update ()
 Called once a frame and updates the timer objects and events. More...
 
void registerEvent (TimeEvent *event)
 Adds a TimeEvent. More...
 
void unregisterEvent (TimeEvent *event)
 Removes a TimeEvent. More...
 
uint32_t getTime () const
 Get the time. More...
 
uint32_t getTimeDelta () const
 Get the time since the last frame. More...
 
double getAverageFrameTime () const
 Gets average frame time. More...
 
void printStatistics () const
 Prints Timer statistics. More...
 
- Public Member Functions inherited from FIFE::DynamicSingleton< TimeManager >
 DynamicSingleton ()
 
virtual ~DynamicSingleton ()
 

Private Attributes

uint32_t m_current_time
 Current time in milliseconds. More...
 
uint32_t m_time_delta
 Time since last frame in milliseconds. More...
 
double m_average_frame_time
 Average frame time in milliseconds. More...
 
std::vector< TimeEvent * > m_events_list
 List of active TimeEvents. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from FIFE::DynamicSingleton< TimeManager >
static TimeManagerinstance ()
 

Detailed Description

Time Manager.

This class is in charge of storing the current time, average frame time, as well as controlling periodic events. Users of this class will have to manually register and unregister events.

See also
TimeEvent

Definition at line 50 of file timemanager.h.

Constructor & Destructor Documentation

FIFE::TimeManager::TimeManager ( )

Default constructor.

Definition at line 42 of file timemanager.cpp.

FIFE::TimeManager::~TimeManager ( )
virtual

Destructor.

Definition at line 48 of file timemanager.cpp.

Member Function Documentation

double FIFE::TimeManager::getAverageFrameTime ( ) const

Gets average frame time.

Returns
Average frame time in milliseconds.

Definition at line 108 of file timemanager.cpp.

References m_average_frame_time.

Referenced by FIFE::Console::updateCaption().

+ Here is the caller graph for this function:

uint32_t FIFE::TimeManager::getTimeDelta ( ) const

Get the time since the last frame.

Returns
Time since last frame in milliseconds.

Definition at line 104 of file timemanager.cpp.

References m_time_delta.

void FIFE::TimeManager::printStatistics ( ) const

Prints Timer statistics.

Definition at line 112 of file timemanager.cpp.

References FIFE::_log, FL_LOG, and m_events_list.

void FIFE::TimeManager::registerEvent ( TimeEvent event)

Adds a TimeEvent.

The event will be updated regularly, depending on its settings.

Parameters
eventThe TimeEvent object to be added.

Definition at line 84 of file timemanager.cpp.

References m_events_list.

Referenced by FIFE::Timer::start().

+ Here is the caller graph for this function:

void FIFE::TimeManager::unregisterEvent ( TimeEvent event)

Removes a TimeEvent.

Removes an event from the list. It will not be deleted.

Parameters
eventThe TimeEvent object to be removed.

Definition at line 89 of file timemanager.cpp.

References m_events_list.

Referenced by FIFE::Timer::stop().

+ Here is the caller graph for this function:

void FIFE::TimeManager::update ( )

Called once a frame and updates the timer objects and events.

Definition at line 51 of file timemanager.cpp.

References m_average_frame_time, m_current_time, m_events_list, and m_time_delta.

Referenced by FIFE::Engine::pump().

+ Here is the caller graph for this function:

Member Data Documentation

double FIFE::TimeManager::m_average_frame_time
private

Average frame time in milliseconds.

Definition at line 106 of file timemanager.h.

Referenced by getAverageFrameTime(), and update().

uint32_t FIFE::TimeManager::m_current_time
private

Current time in milliseconds.

Definition at line 102 of file timemanager.h.

Referenced by getTime(), and update().

std::vector<TimeEvent*> FIFE::TimeManager::m_events_list
private

List of active TimeEvents.

Definition at line 109 of file timemanager.h.

Referenced by printStatistics(), registerEvent(), unregisterEvent(), and update().

uint32_t FIFE::TimeManager::m_time_delta
private

Time since last frame in milliseconds.

Definition at line 104 of file timemanager.h.

Referenced by getTimeDelta(), and update().


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