dding missing doc and cooplean form

This commit is contained in:
Clément Le Bihan
2021-05-26 10:56:06 +02:00
parent 682b4388bb
commit 9b76389698
4 changed files with 35 additions and 1 deletions
@@ -13,20 +13,30 @@ namespace BBM
class Drawable2DComponent : public WAL::Component
{
public:
//! @brief The type of the component
T member;
//! ctor
explicit Drawable2DComponent(WAL::Entity &entity, T member)
: WAL::Component(entity),
member(std::move(member))
{
}
//! @brief Clone a component for another or the same entity.
//! @param entity The entity that owns the ne component.
WAL::Component *clone(WAL::Entity &entity) const override
{
return new Drawable2DComponent(entity, this->member);
}
//! @brief Default copy ctor
Drawable2DComponent(const Drawable2DComponent &) = default;
//! @brief Default dtor
~Drawable2DComponent() override = default;
//! @brief Default assignment operator
Drawable2DComponent &operator=(const Drawable2DComponent &) = delete;
};
}
@@ -13,17 +13,28 @@ namespace BBM
class Drawable3DComponent : public WAL::Component
{
public:
//! @brief The type of the component
T member;
//! @brief ctor
explicit Drawable3DComponent(WAL::Entity &entity, T member)
: WAL::Component(entity),
member(std::move(member))
{
}
//! @brief Clone a component for another or the same entity.
//! @param entity The entity that owns the ne component.
WAL::Component *clone(WAL::Entity &entity) const override
{
return new Drawable3DComponent(entity, this->member);
}
//! @brief Default copy ctor
Drawable3DComponent(const Drawable3DComponent &) = default;
//! @brief Default dtor
~Drawable3DComponent() override = default;
//! @brief Default assignment operator
Drawable3DComponent &operator=(const Drawable3DComponent &) = delete;
};
}
@@ -26,6 +26,9 @@ namespace BBM
{
}
//! @brief Update the corresponding component of the given entity
//! @param entity The entity to update.
//! @param dtime The delta time.
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime) override
{
auto &comp = entity.getComponent<Drawable2DComponent<T>>();
@@ -35,8 +38,11 @@ namespace BBM
comp.member.drawOn(this->_window);
}
//! @brief default copy ctor
Renderer2DSystem(const Renderer2DSystem &) = default;
//! @brief default dtor
~Renderer2DSystem() override = default;
//! @brief Default assignment operator
Renderer2DSystem &operator=(const Renderer2DSystem &) = delete;
};
}
@@ -20,12 +20,16 @@ namespace BBM
//! @brief The class to render
RAY::Window &_window;
public:
//! @brief ctor
explicit Renderer3DSystem(RAY::Window &window)
: WAL::System({typeid(PositionComponent), typeid(Drawable3DComponent<T>)}),
_window(window)
{
}
//! @brief Update the corresponding component of the given entity
//! @param entity The entity to update.
//! @param dtime The delta time.
void onUpdate(WAL::Entity &entity, std::chrono::nanoseconds dtime) override
{
auto &comp = entity.getComponent<Drawable3DComponent<T>>();
@@ -35,8 +39,11 @@ namespace BBM
comp.member.drawOn(this->_window);
}
//! @brief Default copy ctor
Renderer3DSystem(const Renderer3DSystem &) = default;
//! @brief Default dtor
~Renderer3DSystem() override = default;
//! @brief Default assignment operator
Renderer3DSystem &operator=(const Renderer3DSystem &) = delete;
};
}