aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
Diffstat (limited to 'src/example')
-rw-r--r--src/example/script.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/example/script.cpp b/src/example/script.cpp
index 9e8b147..4ba2b4b 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -35,15 +35,15 @@ class MyScript : public Script {
};
int main() {
+ ComponentManager component_manager {};
+ ScriptSystem system { component_manager };
+
// Create game object with Transform and BehaviorScript components
- auto obj = GameObject(0, "name", "tag", Vector2{1.2, 3.4}, 0, 1);
+ auto & obj = component_manager.new_object("name");
obj.add_component<BehaviorScript>().set_script<MyScript>();
- // Get ScriptSystem singleton instance (this would normally be done from the
- // game loop)
- ScriptSystem sys;
// Update all scripts. This should result in MyScript::update being called
- sys.update();
+ system.update();
return EXIT_SUCCESS;
}