aboutsummaryrefslogtreecommitdiff
path: root/src/example
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 11:39:45 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-11-13 11:39:45 +0100
commit455bb50a5007daf46b8719fff2a6292da6a294bf (patch)
treedbba8b1f9653a52bb7105f39323a11d85662c0fe /src/example
parent3e94ecb3dac5003a3d58210ed1a4d1f1cb2083d1 (diff)
fix physics test
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;
}