Engine
Frameworkcreatedbymeusableforthecreationofsimplegames.CurrentlysupportsOpenGL(Verysimple)andVulkan.
CollisionSystem.hpp
Go to the documentation of this file.
1 #pragma once
2 
7 #include "Engine/api.hpp"
8 
9 #include <ThirdParty/Box2D/Box2D/Box2D.h>
10 
11 #include <ThirdParty/EASTL-master/include/EASTL/shared_ptr.h>
12 #include <ThirdParty/EASTL-master/include/EASTL/vector.h>
13 #include <ThirdParty/EASTL-master/include/EASTL/map.h>
14 #include <ThirdParty/glm/glm/detail/type_vec2.hpp>
15 
16 
17 namespace Engine
18 {
23  {
24  friend class Engine;
25  typedef eastl::shared_ptr<Entity> EntityPtr;
26 
28  public:
29  ~CollisionSystem();
30  private:
31 
32  friend class CollisionComponent;
33  void AddCollisionComponent(eastl::weak_ptr<CollisionComponent> componentToAdd);
34  void RemoveCollisionComponent(CollisionComponent* componentToRemove);
35 
36  void OnLevelLoaded();
37  void OnLevelUnloaded();
38  public:
39 
44  void Stop();
45 
50  void Start();
51 
56  void Update();
57 
65  eastl::weak_ptr<Entity> RayQueryFirstHit(const glm::vec2& start, const glm::vec2& end, CollisionLayer detectionLayers) const;
66 
73  eastl::weak_ptr<Entity> RayQueryAllHit(const glm::vec2& start, const glm::vec2& end) const; // TODO - Implementation
74 
79  bool IsRunning() const;
80 
85  eastl::vector<eastl::weak_ptr<CollisionComponent>> GetActiveCollisionComponents() const;
86 
87  private:
91  void ClearWorld();
92 
93  eastl::vector<eastl::weak_ptr<CollisionComponent>> collisionComponents_;
94  b2World world_;
95  bool isRunning_;
96  EntityContact entityContactCallback_;
97  };
98 } // namespace Engine
#define ENGINE_API
Definition: api.hpp:25
The Collision component is an entities link to the Collision System and allows for interaction with t...
The Collision System handles and stores run-time collision data using the Box2D library ...
CollisionLayer
Bitmask Enum that allows for layered collision checking