diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-22 16:11:39 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-22 16:11:39 +0100 |
commit | bcf57e81f68913049f84cabb66871931c8f47b2b (patch) | |
tree | 5f04d161a85bbea27ca9ad8e000a9129a447e88a /src/example | |
parent | 3f63143b4005936da446fb2cdbbd1072b47fc8c1 (diff) |
script fix
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/game.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp index f6b580a..991d2ec 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -17,12 +17,14 @@ using namespace crepe; using namespace std; class MyScript : public Script { - static bool oncollision(const CollisionEvent& test) { + bool oncollision(const CollisionEvent& test) { Log::logf("Box {} script on_collision()", test.info.first.collider.game_object_id); return true; } void init() { - EventManager::get_instance().subscribe<CollisionEvent>(oncollision, 0); + subscribe<CollisionEvent>([this](const CollisionEvent& ev) -> bool { + return this->oncollision(ev); + }); } void update() { // Retrieve component from the same GameObject this script is on |