Normalise event emiters and consumers #13

Open
opened 2026-03-26 13:22:40 +00:00 by Fluffy · 0 comments
Owner

There currently seems to be 3-ish systems of doing events, Application events, Render events and Object handlers. I belive there is possibly a way to normalise this into just event emiters and consumers/handlers...

Something like:

Object.listen_for<Object::Events::Collision>(/* handler */);
Application::listen_for<Application::Events::CreateObject>(/* handler */);
Object.push_event<Object::Events::Collision>(/* args */);
Application::push_event<Application::Events::CreateObject>(/* args */);

The renderer could do something like this, pushing events to objects to render:

RenderTasks task_list;

Object.push_event<Object::Events::Render(&task_list);

for (auto& task : task_list)
{
  task();
}
There currently seems to be 3-ish systems of doing events, Application events, Render events and Object handlers. I belive there is possibly a way to normalise this into just event emiters and consumers/handlers... Something like: ```cpp Object.listen_for<Object::Events::Collision>(/* handler */); Application::listen_for<Application::Events::CreateObject>(/* handler */); ``` ```cpp Object.push_event<Object::Events::Collision>(/* args */); Application::push_event<Application::Events::CreateObject>(/* args */); ``` The renderer could do something like this, pushing events to objects to render: ```cpp RenderTasks task_list; Object.push_event<Object::Events::Render(&task_list); for (auto& task : task_list) { task(); } ```
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Fluffy/UrchinEnginePlusPlus#13
No description provided.