#include #include #include #include #include #include #include #include #include #include using namespace std; using namespace std::chrono_literals; using namespace crepe; class MyScript : public Script { public: static crepe::CollisionSystem::CollisionInfo last_collision_info; private: static bool oncollision(const CollisionEvent& test) { std::cout << "test collision: " << test.info.first.collider.game_object_id << std::endl; return true; } void init() { EventManager::get_instance().subscribe(oncollision, this->get_game_object_id()); } void update() { // Retrieve component from the same GameObject this script is on } }; class CollisionTest : public ::testing::Test { public: ComponentManager component_manager; PhysicsSystem system{component_manager}; void SetUp() override { ComponentManager & mgr = this->component_manager; } }; TEST_F(CollisionTest, collision) { //read static data const CollisionEvent& test = MyScript::last_collision_info; }