aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/example')
-rw-r--r--src/example/script.cpp7
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