Skip to content

engine::object_subscription_list

Paweł Waligóra edited this page May 23, 2024 · 1 revision

This is the core of the entire engine.

Usage

meant to be used by modules to call their components

Example

module.h

#include"object_subscription_list.h"
namespace module {
	extern engine::object_subscribtion_list<my_object> objects;

	// other module variables, functions
}

module.cpp

#include"module.h"
engine::object_subscribtion_list<my_object> module::object;
// other definitions

usage code:

#include "module.h"

// subscribing
my_object mo;
module::objects.subscribe(mo);

// call subscribers
module::events.perform_on_all([](my_object* mop) { mop->method(); };

// unsubscribing
module::events.unsubscribe(&mo);

It is preffered for objects to subscribe at constructor and unsubscribe at destructor.

Home

Git Workflow

Issues

Coding Rules

Skrypty-Tutorial

Useful resources

Game Structure

Code Structure

Clone this wiki locally