diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-16 17:21:04 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-16 17:21:04 +0200 |
commit | 1f82ffa4d3ee8355215d43bf43edf8cecaca0d1d (patch) | |
tree | 218b7f87df6edd5a5e2a13ca5bbcca43b7a717a3 /src/example | |
parent | f9aa198eef7b85eeba3bac4c4fe2d4578b836bbf (diff) |
fix user script implementation
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/script.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/example/script.cpp b/src/example/script.cpp index b8b3c8d..95c4950 100644 --- a/src/example/script.cpp +++ b/src/example/script.cpp @@ -8,15 +8,16 @@ #include <crepe/ComponentManager.h> #include <crepe/GameObject.h> +#include <crepe/api/Script.h> #include <crepe/api/BehaviorScript.h> using namespace crepe; using namespace crepe::api; using namespace std; -class MyScript : public BehaviorScript { +class MyScript : public Script { void update() { - dbg_trace(); + dbg_log("MY SCRIPT UPDATE"); } }; @@ -24,7 +25,7 @@ int main() { dbg_trace(); auto obj = GameObject(0, "name", "tag", 0); - obj.add_component<MyScript>(); + obj.add_component<BehaviorScript>().set_script<MyScript>(); auto & sys = ScriptSystem::get_instance(); sys.update(); // -> MyScript::update |