aboutsummaryrefslogtreecommitdiff
path: root/src/example/game.cpp
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-11-22 16:11:39 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-11-22 16:11:39 +0100
commitbcf57e81f68913049f84cabb66871931c8f47b2b (patch)
tree5f04d161a85bbea27ca9ad8e000a9129a447e88a /src/example/game.cpp
parent3f63143b4005936da446fb2cdbbd1072b47fc8c1 (diff)
script fix
Diffstat (limited to 'src/example/game.cpp')
-rw-r--r--src/example/game.cpp6
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