SimpleCxxLib
packageclass GTimerEvent : public GEvent
GTimer
object, which produces a new event at a fixed interval measured in
milliseconds. As an example, the following program generates a
timer event every two seconds, stopping when the user clicks
somewhere in the window:
int main() { cout << "This program generates timer events." << endl; GTimer timer(2000); timer.start(); while (true) { GEvent e = waitForEvent(CLICK_EVENT | TIMER_EVENT); if (e.getEventType() == MOUSE_CLICKED) break; cout << "Timer ticked" << endl; } return 0; }
Constructor | |
Creates a GTimerEvent for the specified timer. | |
Methods | |
Returns the timer that generated this event. | |
Converts the event to a human-readable representation of the event. |
GTimerEvent(EventType type, const GTimer & timer);
GTimerEvent
for the specified timer.
Usage:
GTimerEvent timerEvent(type, timer);
GTimer getGTimer() const;
Usage:
GTimer timer = e.getGTimer();
string toString() const;
Usage:
string str = e.toString();