#include <Timer.h>
Structors | |
Timer (int interval, int start_time=0) | |
~Timer () | |
Accessors | |
bool | Connected () const |
int | Interval () const |
bool | Running () const |
bool | ShouldFire (int ticks) const |
const std::set< Wnd * > & | Wnds () const |
Mutators | |
void | Reset (int start_time=0) |
void | SetInterval (int interval) |
void | Connect (Wnd *wnd) |
void | Disconnect (Wnd *wnd) |
void | Start () |
void | Stop () |
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 45 of file Timer.h.
GG::Timer::Timer | ( | int | interval, | |
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.
bool GG::Timer::Connected | ( | ) | const |
Returns true iff this Timer has Wnds listening to it.
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.
bool GG::Timer::ShouldFire | ( | int | ticks | ) | const |
Returns true iff the timer is connected, running, and the last time it fired is is more than Interval() ms ago.
const std::set<Wnd*>& GG::Timer::Wnds | ( | ) | const |
Returns the Wnds connected to this timer. Note that the GUI will disconnect dying Wnds automatically.
void GG::Timer::Reset | ( | 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 | ( | 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.