|
Aegis2D
Modular C++26 2D game engine for networked games
|
Deferred event queue dispatched by priority at a chosen point in the tick. More...
#include <aegis2d/core/event_queue.hpp>
Public Member Functions | |
| template<typename Event > | |
| void | push (const Event &event, int priority=0) |
| Queues an event for deferred dispatch. | |
| void | dispatch (EventBus &bus) |
| Dispatches all queued events in priority order and clears the queue. | |
| std::size_t | size () const noexcept |
| Number of events currently in the queue. | |
| void | clear () noexcept |
| Discards all queued events without dispatching them. | |
Deferred event queue dispatched by priority at a chosen point in the tick.
Events are pushed at any point during a tick, then dispatched all at once in priority order by calling dispatch(). Higher numeric priorities are dispatched first; events with the same priority are dispatched in push() order (stable).
Use EventQueue when the dispatch order across event types matters, or when handlers must not run mid-tick. Use EventBus when reactions are immediate (audio, effects, cross-module callbacks) and do not need ordering between event types.
|
inlinenoexcept |
Discards all queued events without dispatching them.
|
inline |
Dispatches all queued events in priority order and clears the queue.
Events with equal priority are dispatched in push() order (stable sort). Handlers subscribed on bus are called in the usual subscription order.
| bus | Bus to publish each event on. |
|
inline |
Queues an event for deferred dispatch.
| event | Event to queue; copied into the queue. |
| priority | Dispatch order: higher values are dispatched before lower ones. |
|
inlinenoexcept |
Number of events currently in the queue.