FIFE
be64c707dea6b3250bd4355bf5c825d25920087d
|
Interface for events to be registered with TimeManager. More...
#include <timeevent.h>
Public Member Functions | |
TimeEvent (int32_t period=-1) | |
Default constructor. More... | |
virtual | ~TimeEvent () |
Destructor. More... | |
virtual void | updateEvent (uint32_t time)=0 |
Update function to be overridden by client. More... | |
void | managerUpdateEvent (uint32_t time) |
Called by TimeManager to update the event. More... | |
void | setPeriod (int32_t period) |
Set the period of the event. More... | |
int32_t | getPeriod () |
Get the period of the event. More... | |
uint32_t | getLastUpdateTime () |
Get the last time the event was updated. More... | |
void | setLastUpdateTime (uint32_t ms) |
Set the last time the event was updated. More... | |
Private Attributes | |
int32_t | m_period |
uint32_t | m_last_updated |
Interface for events to be registered with TimeManager.
To register a class with TimeManager firstly derive a class from this and override the updateEvent() function. updateEvent() will be called periodically depending on the value of getPeriod() which can be set using the constructor or setPeriod(). A value of -1 will never be updated, 0 will updated every frame and a value over 0 defines the number of milliseconds between updates.
Definition at line 48 of file timeevent.h.
FIFE::TimeEvent::TimeEvent | ( | int32_t | period = -1 | ) |
Default constructor.
period | The period of the event. See class description. |
Definition at line 37 of file timeevent.cpp.
|
virtual |
Destructor.
Definition at line 42 of file timeevent.cpp.
uint32_t FIFE::TimeEvent::getLastUpdateTime | ( | ) |
Get the last time the event was updated.
Definition at line 64 of file timeevent.cpp.
References m_last_updated.
int32_t FIFE::TimeEvent::getPeriod | ( | ) |
Get the period of the event.
Definition at line 60 of file timeevent.cpp.
References m_period.
void FIFE::TimeEvent::managerUpdateEvent | ( | uint32_t | time | ) |
Called by TimeManager to update the event.
time | Current time. Used To check if its time to update. |
Definition at line 46 of file timeevent.cpp.
References m_last_updated, m_period, and updateEvent().
void FIFE::TimeEvent::setLastUpdateTime | ( | uint32_t | ms | ) |
Set the last time the event was updated.
ms | Time of last update. |
Definition at line 68 of file timeevent.cpp.
References m_last_updated.
Referenced by FIFE::Timer::start().
void FIFE::TimeEvent::setPeriod | ( | int32_t | period | ) |
Set the period of the event.
period | The period of the event. See class description. |
Definition at line 56 of file timeevent.cpp.
References m_period.
Referenced by FIFE::Timer::setInterval().
|
pure virtual |
Update function to be overridden by client.
time | Time delta. |
Implemented in FIFE::Timer.
Referenced by managerUpdateEvent().
|
private |
Definition at line 102 of file timeevent.h.
Referenced by getLastUpdateTime(), managerUpdateEvent(), and setLastUpdateTime().
|
private |
Definition at line 99 of file timeevent.h.
Referenced by getPeriod(), managerUpdateEvent(), and setPeriod().