23 glm::vec3
scale = glm::vec3(1.0f);
33 m_components.push_back(comp);
43 for (
auto* c : m_components)
45 T* target =
dynamic_cast<T*
>(c);
67 for (
auto* c : m_components)
76 for (
auto* c : m_components)
81 std::vector<IComponent*> m_components;
float dt
Definition Main.cpp:10
#define ANVIL_API
Definition ACore.h:6
Represents an entity in the game engine with position, rotation, scale and components.
Definition AEntity.h:16
void Update(float dt)
Updates all components attached to this entity.
Definition AEntity.h:65
glm::vec3 scale
Definition AEntity.h:23
~AEntity()
Destructor that cleans up all attached components.
Definition AEntity.h:74
glm::vec3 rotation
Definition AEntity.h:22
std::string name
Definition AEntity.h:20
T * GetComponent()
Gets a specific component by type.
Definition AEntity.h:41
const std::vector< IComponent * > & GetComponents() const
Gets all components attached to this entity.
Definition AEntity.h:56
glm::vec3 position
Definition AEntity.h:21
void AddComponent(IComponent *comp)
Adds a component to the entity and initializes it.
Definition AEntity.h:29
The IComponent class is an abstract base class that defines the interface for all components in the A...
Definition IComponent.h:12
virtual void OnInit(AEntity *owner)=0
Called when the component is initialized.