9 std::chrono::steady_clock::time_point
fireAt;
25 void schedule(std::chrono::milliseconds delay, std::function<
void()> cb);
46 std::priority_queue<TimedEvent, std::vector<TimedEvent>, std::greater<TimedEvent>>
_queue;
Priority queue of timed callbacks. Drives all game timing.
void schedule(std::chrono::milliseconds delay, std::function< void()> cb)
void clear()
Drop all pending events (e.g. on game end, to freeze the world instantly).
std::priority_queue< TimedEvent, std::vector< TimedEvent >, std::greater< TimedEvent > > _queue
int msUntilNext() const
Milliseconds until the next event. Pass directly to poll() as timeout. Returns -1 if the queue is emp...
void rescale(float ratio)
Rescale all pending fire times by ratio.
A callback and the time it should fire. Min-heap ordered by fireAt.
std::function< void()> callback
std::chrono::steady_clock::time_point fireAt
bool operator>(const TimedEvent &other) const