|
FIFE
|
#include <timer.h>
Inheritance diagram for FIFE::Timer:
Collaboration diagram for FIFE::Timer:Public Types | |
| typedef boost::function0< void > | type_callback |
Public Member Functions | |
| Timer () | |
| Default constructor. More... | |
| virtual | ~Timer () |
| Destructor. More... | |
| void | setInterval (int32_t msec) |
| Set the interval in milliseconds. More... | |
| void | start () |
| Start the timer. More... | |
| void | stop () |
| Stop the timer. More... | |
| void | setCallback (const type_callback &callback) |
| Set the callback that will be called. More... | |
Protected Member Functions | |
| void | updateEvent (uint32_t) |
| Update function to be overridden by client. More... | |
Protected Member Functions inherited from FIFE::TimeEvent | |
| TimeEvent (int32_t period=-1) | |
| Default constructor. More... | |
| virtual | ~TimeEvent () |
| Destructor. 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... | |
Protected Attributes | |
| bool | m_active |
| type_callback | m_callback |
Simple Timer class.
This is a simple wrapper around the TimeEvent, which makes the later usable without having to subclass it every time.
| typedef boost::function0<void> FIFE::Timer::type_callback |
| FIFE::Timer::Timer | ( | ) |
Default constructor.
Constructs an idle timer, use
|
virtual |
| void FIFE::Timer::setCallback | ( | const type_callback & | callback | ) |
Set the callback that will be called.
| callback | A boost::function0 returning void |
Definition at line 64 of file timer.cpp.
References m_callback.
Referenced by FIFE::CommandLine::CommandLine(), FIFE::Console::Console(), FIFE::DAT2::DAT2(), FIFE::InstanceRenderer::InstanceRenderer(), and FIFE::TextRenderPool::TextRenderPool().
Here is the caller graph for this function:| void FIFE::Timer::setInterval | ( | int32_t | msec | ) |
Set the interval in milliseconds.
| msec | The interval If you use an intervall 0 the timer will fire every frame. |
Definition at line 60 of file timer.cpp.
References FIFE::TimeEvent::setPeriod(), and stop().
Referenced by FIFE::CommandLine::CommandLine(), FIFE::Console::Console(), FIFE::DAT2::DAT2(), FIFE::InstanceRenderer::InstanceRenderer(), FIFE::InstanceRenderer::setRemoveInterval(), and FIFE::TextRenderPool::TextRenderPool().
Here is the caller graph for this function:| void FIFE::Timer::start | ( | ) |
Start the timer.
Without calling this function, nothing will happen. It is save to call this more than once.
Definition at line 45 of file timer.cpp.
References FIFE::DynamicSingleton< TimeManager >::instance(), m_active, FIFE::TimeManager::registerEvent(), and FIFE::TimeEvent::setLastUpdateTime().
Referenced by FIFE::TextRenderPool::addRenderedText(), FIFE::InstanceRenderer::addToCheck(), FIFE::CommandLine::CommandLine(), FIFE::DAT2::DAT2(), FIFE::Console::doShow(), FIFE::Console::hide(), FIFE::Console::show(), FIFE::CommandLine::startBlinking(), FIFE::CommandLine::stopBlinking(), and FIFE::Console::toggleShowHide().
Here is the caller graph for this function:| void FIFE::Timer::stop | ( | ) |
Stop the timer.
Stops execution of the callback It is save to call this more than once.
Definition at line 53 of file timer.cpp.
References FIFE::DynamicSingleton< TimeManager >::instance(), m_active, and FIFE::TimeManager::unregisterEvent().
Referenced by FIFE::InstanceRenderer::check(), FIFE::Console::doHide(), FIFE::DAT2::readFileEntry(), FIFE::InstanceRenderer::removeFromCheck(), FIFE::TextRenderPool::removeOldEntries(), FIFE::InstanceRenderer::reset(), setInterval(), FIFE::CommandLine::startBlinking(), FIFE::CommandLine::stopBlinking(), FIFE::Console::updateAnimation(), and ~Timer().
Here is the caller graph for this function:
|
protectedvirtual |
Update function to be overridden by client.
| time | Time delta. |
Implements FIFE::TimeEvent.
Definition at line 68 of file timer.cpp.
References m_active, and m_callback.
|
protected |
Definition at line 106 of file timer.h.
Referenced by start(), stop(), and updateEvent().
|
protected |
Definition at line 107 of file timer.h.
Referenced by setCallback(), and updateEvent().