Skip to content

Engine → ECS

observer.h

Observers. Observers run synchronously on the owner thread inside the structural operation that triggered them and may only enqueue follow-up work into the deferred command buffer they receive; the world drains that buffer once the operation has finished.

Structs

File Description
observer_id Handle of a registered observer. A default-constructed id refers to nothing.

Enumerations

component_event

enum class component_event : u8 {
    ADDED,
    REMOVED
};

Component lifecycle events observers can subscribe to. ADDED fires after the component data exists, REMOVED before it is destroyed.

Type Aliases

component_observer_fn

using component_observer_fn = std::function<void(world &owner, entity target, component_id id, command_buffer &deferred)>;

Callback for a component event on one entity.

entity_observer_fn

using entity_observer_fn = std::function<void(world &owner, entity target, command_buffer &deferred)>;

Callback invoked when an entity is about to be destroyed (its components still exist).

Forward Declarations

command_buffer

class command_buffer;

world

class world;