diff options
Diffstat (limited to 'src/example/script.cpp')
-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 |