Mountain  1.0.0
Simple C++ 2D Game Framework
entity.hpp
1 #pragma once
2 
3 #include "Mountain/core.hpp"
4 
5 #include <Maths/vector2.hpp>
6 
7 #include "Mountain/collision/collider.hpp"
10 
11 namespace Mountain
12 {
13  class Entity
14  {
15  public:
16  Vector2 position;
17 
18  MOUNTAIN_API Entity() = default;
19 
20  MOUNTAIN_API explicit Entity(const Vector2& position);
21 
22  MOUNTAIN_API virtual ~Entity();
23 
24  DEFAULT_COPY_MOVE_OPERATIONS(Entity)
25 
26  MOUNTAIN_API virtual void Update();
27 
28  MOUNTAIN_API virtual void Render();
29 
30  MOUNTAIN_API virtual void RenderDebug();
31 
32  MOUNTAIN_API void AddComponent(Component* component);
33 
34  template <Concepts::ComponentT T, typename... Args>
35  T* AddComponent(Args&&... args);
36 
37  template <Concepts::ComponentT T>
38  [[nodiscard]]
39  T* GetComponent() const;
40 
41  [[nodiscard]]
42  MOUNTAIN_API List<Component*>& GetComponents();
43 
44  [[nodiscard]]
45  MOUNTAIN_API const List<Component*>& GetComponents() const;
46 
47  MOUNTAIN_API void RemoveComponent(Component* component);
48 
49  template <Concepts::ComponentT T>
50  void RemoveComponent();
51 
52  MOUNTAIN_API const Collider* GetCollider() const;
53 
54  MOUNTAIN_API Collider* GetCollider();
55 
56  protected:
57  Collider* m_Collider = nullptr;
58 
59  private:
60  List<Component*> m_Components;
61  };
62 }
63 
64 #include "Mountain/scene/entity.inl"
Represents a behavior that can be attached to an Entity.
Definition: component.hpp:10
Defines the Mountain::List class.
A dynamic array implementation. Wrapper around the std::vector class.
Definition: list.hpp:24
Defines the Mountain::Concepts namespace which contains useful concepts used in the engine...
Contains all declarations of the Mountain Framework.
Definition: audio.hpp:22