RedCore
Loading...
Searching...
No Matches
Event System

RedCore provides a simple event system for hooking into various parts of the game's execution. See include/red/event for a full list of events.

To subscribe to an event, create a listener object from the target class, pass the desired stage if applicable, and then pass a lambda to be called when the event is triggered. Example with red::RenderStepEvent:

#include <telkin/Print.h>
using namespace red;
tk::println("Rendering on layer %d", e.getRenderInfo().getLayerIndex());
});
s32 getLayerIndex() const
Definition RenderStepEvent.h:24
Definition RenderStepEvent.h:14
agl::lyr::RenderInfo & getRenderInfo() const
Definition RenderStepEvent.h:44
Definition ActorDonutBlock.h:5

An optional priority parameter can be passed to the listener after the lambda, where a higher number fires earlier and the default is 0.