aboutsummaryrefslogtreecommitdiff
path: root/src/example/script.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-22 12:15:49 +0200
committerheavydemon21 <nielsstunnebrink1@gmail.com>2024-10-22 12:15:49 +0200
commit6b213f304b35be5c11bbea305698d6e365a7ffca (patch)
tree4526831be8e6a09a9e1608b71294213ce57fddb1 /src/example/script.cpp
parent9037aca03bfa4312794a6954752628381256f777 (diff)
parent30d84ef9ad4a0010288db18294766fd4d5ed6f4a (diff)
Merge branch 'master' into niels/rendering
Diffstat (limited to 'src/example/script.cpp')
-rw-r--r--src/example/script.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/example/script.cpp b/src/example/script.cpp
index a610b83..cc585db 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -9,19 +9,21 @@
#include <crepe/util/log.h>
#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/Script.h>
using namespace crepe;
+using namespace crepe::api;
using namespace std;
-class MyScript : public api::BehaviorScript {
- void update() { dbg_trace(); }
+class MyScript : public Script {
+ void update() { dbg_log("MY SCRIPT UPDATE"); }
};
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