Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
CollisionCallback.cpp
Go to the documentation of this file.
2 
3 #include "Engine/engine.hpp"
4 
5 namespace Engine {
6 
7  void EntityContact::BeginContact(b2Contact* contact)
8  {
9  GetEntities(contact);
10 
11  entityA_.lock()->OnBeginContact(entityB_);
12  entityB_.lock()->OnBeginContact(entityA_);
13  }
14 
15  void EntityContact::EndContact(b2Contact* contact)
16  {
17  GetEntities(contact);
18 
19  entityA_.lock()->OnEndContact(entityB_);
20  entityB_.lock()->OnEndContact(entityA_);
21  }
22 
23  void EntityContact::GetEntities(b2Contact* contact)
24  {
25  eastl::weak_ptr<EntitySystem> entitySystem = Engine::GetEngine().lock()->GetEntitySystem();
26 
27  const uint64_t entityIdA = uint64_t(contact->GetFixtureA()->GetUserData());
28  const uint64_t entityIdB = uint64_t(contact->GetFixtureB()->GetUserData());
29 
30  entityA_ = entitySystem.lock()->GetEntity(entityIdA);
31  entityB_ = entitySystem.lock()->GetEntity(entityIdB);
32  }
33 } // namespace Engine
static eastl::weak_ptr< Engine > GetEngine() noexcept
This method allows you to get the instance of the Engine. This method will automatically initialize t...
Definition: engine.cpp:130