Anvil Engine
Loading...
Searching...
No Matches
AEntity Class Reference

Represents an entity in the game engine with position, rotation, scale and components. More...

#include <AEntity.h>

Public Member Functions

void AddComponent (IComponent *comp)
 Adds a component to the entity and initializes it.
template<typename T>
T * GetComponent ()
 Gets a specific component by type.
const std::vector< IComponent * > & GetComponents () const
 Gets all components attached to this entity.
void Update (float dt)
 Updates all components attached to this entity.
 ~AEntity ()
 Destructor that cleans up all attached components.

Public Attributes

std::string name
glm::vec3 position = glm::vec3(0.0f)
glm::vec3 rotation = glm::vec3(0.0f)
glm::vec3 scale = glm::vec3(1.0f)

Detailed Description

Represents an entity in the game engine with position, rotation, scale and components.

Represents a basic entity in the game engine, which can hold components and has transform properties.

Constructor & Destructor Documentation

◆ ~AEntity()

AEntity::~AEntity ( )
inline

Destructor that cleans up all attached components.

Member Function Documentation

◆ AddComponent()

void AEntity::AddComponent ( IComponent * comp)
inline

Adds a component to the entity and initializes it.

Parameters
compPointer to the component to be added

◆ GetComponent()

template<typename T>
T * AEntity::GetComponent ( )
inline

Gets a specific component by type.

Template Parameters
TType of the component to retrieve
Returns
Pointer to the component if found, nullptr otherwise

◆ GetComponents()

const std::vector< IComponent * > & AEntity::GetComponents ( ) const
inline

Gets all components attached to this entity.

Returns
Constant reference to the vector of components

◆ Update()

void AEntity::Update ( float dt)
inline

Updates all components attached to this entity.

Parameters
dtDelta time for frame-independent updates

Member Data Documentation

◆ name

std::string AEntity::name

◆ position

glm::vec3 AEntity::position = glm::vec3(0.0f)

◆ rotation

glm::vec3 AEntity::rotation = glm::vec3(0.0f)

◆ scale

glm::vec3 AEntity::scale = glm::vec3(1.0f)

The documentation for this class was generated from the following file: