-
Notifications
You must be signed in to change notification settings - Fork 0
engine::event_subscription_list
Paweł Waligóra edited this page Apr 18, 2024
·
4 revisions
This is the core of the entire engine.
meant to be used by modules to call their components
module.h
#include"event_subscription_list.h"
namespace module {
extern engine::event_subscribtion_list<> events;
// other module variables, functions
}
module.cpp
#include"module.h"
engine::event_subscribtion_list<> module::events;
// other definitions
usage code:
#include "module.h"
// subscribing
void func() { /* code */ }
module::events.subscribe(func); // subscribing function
some_object o;
module::events.subscribe(std::bind(&some_object::some_method, &o)); // subscribing object method
module::events.subscribe([](){/* code */}); // subscribing lambda
// call subscribers
module::events.call_events();
// unsubscribing
int* id = module::events.subscribe([](){/* code */}); // subscribe returns a pointer
module::events.unsubscribe(&id); // that needs to be passed to list to unsubscribe
- engine
- scripts_system
- scene_loader
- time_system
-
input_system
- input_system::key_held
- input_system::key_events
- input_system::subscribe() (deprecated)
- input_system::axis_state()
- input_system::key_bind
- input_system::axis
- input_system::double_axis
- input_system::triple_axis
- input_system::axis2
- input_system::double_axis2
- input_system::triple_axis2
- input_system::axis-choice
- renderer
- physics
- ui_system
- game