mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-20 21:35:12 +00:00
alalalallalalllala
This commit is contained in:
48
sources/Component/Renderer/Drawable2DComponent.hpp
Normal file
48
sources/Component/Renderer/Drawable2DComponent.hpp
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Created by cbihan on 24/05/2021.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Component/Component.hpp"
|
||||
#include "Drawables/ADrawable2D.hpp"
|
||||
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Drawable2DComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
//! @brief The type of the component
|
||||
T member;
|
||||
|
||||
//! ctor
|
||||
Drawable2DComponent(WAL::Entity &entity, T member)
|
||||
: WAL::Component(entity),
|
||||
member(std::move(member))
|
||||
{}
|
||||
|
||||
//! ctor
|
||||
template<typename ...Params>
|
||||
explicit Drawable2DComponent(WAL::Entity &entity, Params &&...params)
|
||||
: WAL::Component(entity),
|
||||
member(std::forward<Params>(params)...)
|
||||
{}
|
||||
|
||||
//! @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;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user