mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-07 11:34:46 +00:00
compiling with templated component
This commit is contained in:
@@ -10,18 +10,21 @@
|
||||
namespace BBM
|
||||
{
|
||||
template <class T>
|
||||
class Drawable2DComponent : public WAL::Component, public T
|
||||
class Drawable2DComponent : public WAL::Component
|
||||
{
|
||||
public:
|
||||
|
||||
explicit Drawable2DComponent(WAL::Entity &entity)
|
||||
: WAL::Component(entity)
|
||||
T member;
|
||||
|
||||
explicit Drawable2DComponent(WAL::Entity &entity, T member)
|
||||
: WAL::Component(entity),
|
||||
member(std::move(member))
|
||||
{
|
||||
}
|
||||
|
||||
WAL::Component *clone(WAL::Entity &entity) const override
|
||||
{
|
||||
return new Drawable2DComponent(entity);
|
||||
return new Drawable2DComponent(entity, this->member);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,8 +15,9 @@ namespace BBM
|
||||
public:
|
||||
T member;
|
||||
|
||||
explicit Drawable3DComponent(WAL::Entity &entity)
|
||||
: WAL::Component(entity)
|
||||
explicit Drawable3DComponent(WAL::Entity &entity, T member)
|
||||
: WAL::Component(entity),
|
||||
member(std::move(member))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -36,7 +36,10 @@ int main()
|
||||
RAY::Vector3(0.0f, 1.0f, 0.0f),
|
||||
45.0f, CAMERA_PERSPECTIVE
|
||||
);
|
||||
BBM::Renderer2DSystem<RAY::Drawables::Drawables2D::Text> textSystem(window);
|
||||
RAY::Drawables::Drawables2D::Circle circle{10, 10, 10, 0};
|
||||
WAL::Entity myEntity{"myEntity"};
|
||||
BBM::Drawable2DComponent<RAY::Drawables::Drawables2D::Circle> circleComponent(myEntity, circle);
|
||||
//BBM::Renderer2DSystem<RAY::Drawables::Drawables2D::Circle> textSystem(window);
|
||||
RAY::Model model("assets/guy.iqm");
|
||||
RAY::Texture texture("assets/guytex.png");
|
||||
RAY::ModelAnimations animations("assets/guy.iqm");
|
||||
|
||||
Reference in New Issue
Block a user