Module dagon.core.event

Primitives and tools for event-driven programming.

Description

The dagon.core.event module defines the EventType enumeration, the Event struct, the EventManager class for event polling and storing, and the EventListener base class for handling events.

EventManager is single-threaded. For multi-threaded event/message passing, use MessageBroker.

Functions

NameDescription
messageEvent(sender, recipient, message, payload, domain) Constructs a message event.
taskEvent(sender, recipient, callback, payload, domain) Constructs a task event.

Interfaces

NameDescription
InputDevice Interface for input event emitters. Implementations of this interface can generate events using EventManager.addEvent method.

Classes

NameDescription
EventDispatcher Base class for event dispatchers.
EventListener Base class for single-threaded event listeners.
EventManager Manages event polling, event queue and input state.

Structs

NameDescription
Event Represents a single event in the Dagon event system. Contains event type and relevant data for the event.
GameInputDevice A structure that represents game input device.

Enums

NameDescription
EventType All supported event types in Dagon.
GameInputDeviceType Enumeration of supported game input device types.
MessageDomain Communication layer Event is subject to. Circular - event goes to both message broker and main-thread event listeners; ITC - event goes to the message broker; MainThread - event goes to main-thread event listeners.

Manifest constants

NameTypeDescription
MAX_CONTROLLERS Maximum number of supported controllers.

Aliases

NameTypeDescription
TaskCallback void delegate(Object, void*) A delegate that can be used as an asynchronous callback in task events. executor parameter is meant to be the object that executes the task. payload is user-defined pointer passed with the event.