aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/Script.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-22 13:31:15 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-22 13:31:15 +0100
commitc0f0cc3d95eed2b24d19a157933c2a0ff5d2d4c2 (patch)
treefecc238a33a5e0cc663bef7bb93ddea694c50cb0 /src/crepe/api/Script.cpp
parent07bca38a27f794ed6a2f74536f7a909530ce7df0 (diff)
parent25054cca2a8d06d1ceb60451db8dc383bc629eb8 (diff)
Merge branch 'loek/scripts'
Diffstat (limited to 'src/crepe/api/Script.cpp')
-rw-r--r--src/crepe/api/Script.cpp15
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);
+}