#include <Timer.h>
Public Attributes | |
FiredSignalType | FiredSignal |
Signal Types | |
typedef boost::signal< void(unsigned int, Timer *) | FiredSignalType ) |
Structors | |
Timer (unsigned int interval, unsigned int start_time=0) | |
~Timer () | |
Accessors | |
unsigned int | Interval () const |
bool | Running () const |
Mutators | |
void | Reset (unsigned int start_time=0) |
void | SetInterval (unsigned int interval) |
void | Connect (Wnd *wnd) |
void | Disconnect (Wnd *wnd) |
void | Start () |
void | Stop () |
void | Update (unsigned int ticks) |
The rate at which the Timer fires is not realtime. That is, there are no guarantees on the interval between firings other than that a minimum of Interval() ms will have elapsed. Note that Timers do not rely on Boost signals to propagate firing messages, so a Timers's Wnd connections will survive a serialization-deserialization cycle.
Definition at line 49 of file Timer.h.
typedef boost::signal<void (unsigned int, Timer*) GG::Timer::FiredSignalType) |
GG::Timer::Timer | ( | unsigned int | interval, | |
unsigned int | start_time = 0 | |||
) | [explicit] |
Basic ctor. Takes an interval and a start time in ms; if the start time is ommitted, the start time will be immediate.
GG::Timer::~Timer | ( | ) |
Dtor.
unsigned int GG::Timer::Interval | ( | ) | const |
Returns the interval in ms between firings of the timer.
bool GG::Timer::Running | ( | ) | const |
Returns true iff the timer is operating. When false, this indicates that no firings will occur until Start() is called.
void GG::Timer::Reset | ( | unsigned int | start_time = 0 |
) |
Resets the last-firing time of the timer to start_time (in ms), or the current time if start_time is ommitted.
void GG::Timer::SetInterval | ( | unsigned int | interval | ) |
Sets the interval in ms between firings of the timer.
void GG::Timer::Connect | ( | Wnd * | wnd | ) |
Connects this timer to wnd, meaning that wnd will be notified when the timer fires.
void GG::Timer::Disconnect | ( | Wnd * | wnd | ) |
Disconnects this timer from wnd.
void GG::Timer::Start | ( | ) |
Starts the timer firing; does not reset the timer.
void GG::Timer::Stop | ( | ) |
Stops the timer firing until Start() is called.
void GG::Timer::Update | ( | unsigned int | ticks | ) |
Signals listeners iff the timer is running and the last time it fired is is more than Interval() ms ago.
FiredSignalType GG::Timer::FiredSignal [mutable] |