Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
entity.h
Go to the documentation of this file.
1 #ifndef ENTITY_H
2 #define ENTITY_H
3 
4 #include <vector>
5 #include <memory>
6 #include "component.h"
7 #include "transform.h"
8 #include "graphics/camera.h"
9 
10 //= SCRIPTABLE
11 
15 class Entity : public std::enable_shared_from_this<Entity> {
16  private:
17  std::shared_ptr<Transform> transform;
18  bool active;
19  protected:
20  std::list<std::shared_ptr<Component>> components;
21  public:
22  //= BEGIN SCRIPTABLE
23 
27  Entity();
33  void addComponent(std::shared_ptr<Component> component);
39  void removeComponent(std::shared_ptr<Component> component);
45  std::list<std::shared_ptr<Component>>& getComponents() noexcept;
51  std::shared_ptr<Transform> getTransform() const noexcept;
57  void setActive(const bool active) noexcept;
63  bool isActive() const noexcept;
64  //= END SCRIPTABLE
65 };
66 
67 #endif
std::list< std::shared_ptr< Component > > components
Definition: entity.h:20
Entity()
Entity constructor.
Definition: entity.cpp:5
Class for transform.
Definition: transform.h:13
bool isActive() const noexcept
Determines if active.
Definition: entity.cpp:48
Class for entity in the engine.
Definition: entity.h:15
std::shared_ptr< Transform > getTransform() const noexcept
Gets the transform.
Definition: entity.cpp:37
std::list< std::shared_ptr< Component > > & getComponents() noexcept
Gets the components.
Definition: entity.cpp:33
void addComponent(std::shared_ptr< Component > component)
Adds a component.
Definition: entity.cpp:9
void setActive(const bool active) noexcept
Sets entity active or inactive.
Definition: entity.cpp:41
void removeComponent(std::shared_ptr< Component > component)
Removes a component.
Definition: entity.cpp:23