aboutsummaryrefslogtreecommitdiff
path: root/src/example/game.cpp
diff options
context:
space:
mode:
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