aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api/BehaviorScript.h
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-10-16 17:21:04 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-10-16 17:21:04 +0200
commit1f82ffa4d3ee8355215d43bf43edf8cecaca0d1d (patch)
tree218b7f87df6edd5a5e2a13ca5bbcca43b7a717a3 /src/crepe/api/BehaviorScript.h
parentf9aa198eef7b85eeba3bac4c4fe2d4578b836bbf (diff)
fix user script implementation
Diffstat (limited to 'src/crepe/api/BehaviorScript.h')
-rw-r--r--src/crepe/api/BehaviorScript.h24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/crepe/api/BehaviorScript.h b/src/crepe/api/BehaviorScript.h
index dd04dc0..052d764 100644
--- a/src/crepe/api/BehaviorScript.h
+++ b/src/crepe/api/BehaviorScript.h
@@ -1,21 +1,33 @@
#pragma once
-#include "../Script.h"
#include "../Component.h"
+namespace crepe {
+class ScriptSystem;
+class ComponentManager;
+}
+
namespace crepe::api {
-class BehaviorScript : public Script, public Component {
+class Script;
+
+class BehaviorScript : public Component {
protected:
- // only allow ComponentManager to instantiate scripts
- friend class ComponentManager;
+ friend class crepe::ComponentManager;
BehaviorScript();
public:
- // but allow uniqe_ptr to call the destructor (THIS IS VERY IMPORTANT)
virtual ~BehaviorScript() = default;
- static BehaviorScript * component;
+public:
+ template<class T>
+ BehaviorScript & set_script();
+
+protected:
+ friend class crepe::ScriptSystem;
+ Script * script = nullptr;
};
}
+#include "BehaviorScript.hpp"
+