aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/BehaviorScript.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 13:10:25 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 13:10:25 +0100
commitfac06d488e635583307cd4a916a611500fb64c16 (patch)
treef62f79cc8ba540498d5dfa1deb4379469738a682 /src/crepe/api/BehaviorScript.h
parent9d58e897fb68ab8dd001a5085cde2fae4634c274 (diff)
cleanup + fix examples
Diffstat (limited to 'src/crepe/api/BehaviorScript.h')
-rw-r--r--src/crepe/api/BehaviorScript.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/crepe/api/BehaviorScript.h b/src/crepe/api/BehaviorScript.h
index f156081..a49fc96 100644
--- a/src/crepe/api/BehaviorScript.h
+++ b/src/crepe/api/BehaviorScript.h
@@ -3,6 +3,7 @@
#include <memory>
#include "../Component.h"
+#include "GameObject.h"
namespace crepe {
@@ -44,6 +45,18 @@ private:
friend class Script;
};
+/**
+ * \brief Add a BehaviorScript component to this game object
+ *
+ * The \c BehaviorScript class is the only exception to the ECS harmony, and
+ * requires a reference to the component manager passed to its constructor in
+ * order to function normally. This is because the \c BehaviorScript (and \c
+ * Script) classes are the only component-related classes that store
+ * implemented member functions as data.
+ */
+template <>
+BehaviorScript & GameObject::add_component<BehaviorScript>();
+
} // namespace crepe
#include "BehaviorScript.hpp"