Adding a position componentn and a vector3

This commit is contained in:
Zoe Roux
2021-05-17 12:31:02 +02:00
parent 2015705f11
commit e98a73f2ea
9 changed files with 292 additions and 17 deletions

View File

@@ -0,0 +1,45 @@
//
// Created by Zoe Roux on 5/17/21.
//
#pragma once
#include "Models/Vector3.hpp"
#include "Component/Component.hpp"
namespace WAL::Components
{
//! @brief A basic position component
class PositionComponent : public Component
{
private:
//! @brief The position of the entity as a vector3.
Vector3f _position;
public:
//! @brief Get the editable position of this entity
Vector3f &getPosition();
//! @brief Get the const position of this entity
const Vector3f &getPosition() const;
//! @brief Get the X position of this entity.
float getX() const;
//! @brief Get the Y position of this entity.
float getY() const;
//! @brief Get the Z position of this entity.
float getZ() const;
//! @inherit
Component *clone(Entity &entity) const override;
//! @brief Create a new PositionComponent linked to a specific entity
explicit PositionComponent(Entity &entity);
//! @brief Create a new PositionComponent at a certain position
PositionComponent(float x, float y, float z, Entity &entity);
//! @brief A position component is copy constructable
PositionComponent(const PositionComponent &) = default;
//! @brief A default destructor
~PositionComponent() override = default;
//! @brief A position component is not assignable
PositionComponent &operator=(const PositionComponent &) = delete;
};
}