diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-11-24 11:58:23 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-11-24 11:58:23 +0100 |
commit | f235743e60fd183319d3cdfb103318739ecbb1e9 (patch) | |
tree | 30817cbc4977f6ffc7951268cb6696e408480b5f /src/crepe/api/Script.cpp | |
parent | b1caa74439b404e4b3fe911836004dd7cb47dd50 (diff) | |
parent | 1499363d85abedbdb571e33801b821f4dfabc638 (diff) |
Merge remote-tracking branch 'origin/master' into max/ecs
Diffstat (limited to 'src/crepe/api/Script.cpp')
-rw-r--r-- | src/crepe/api/Script.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/crepe/api/Script.cpp b/src/crepe/api/Script.cpp new file mode 100644 index 0000000..fcbe4c7 --- /dev/null +++ b/src/crepe/api/Script.cpp @@ -0,0 +1,15 @@ +#include "Script.h" + +using namespace crepe; + +Script::~Script() { + EventManager & evmgr = this->event_manager; + for (auto id : this->listeners) { + evmgr.unsubscribe(id); + } +} + +template <> +void Script::subscribe(const EventHandler<CollisionEvent> & callback) { + this->subscribe_internal(callback, this->game_object_id); +} |