display simpe stat, no update

This commit is contained in:
arthur.jamet
2021-06-16 16:32:07 +02:00
parent b81fefc4e0
commit a11eef468c
9 changed files with 221 additions and 10 deletions
+19
View File
@@ -0,0 +1,19 @@
//
//
//
#include "StatComponent.hpp"
namespace BBM
{
StatComponent::StatComponent(WAL::Entity &entity, WAL::Callback<Drawable2DComponent &> callback)
: Component(entity),
updater(callback)
{}
WAL::Component *StatComponent::clone(WAL::Entity &entity) const
{
return new StatComponent(entity, this->updater);
}
} // namespace WAL
+33
View File
@@ -0,0 +1,33 @@
//
//
//
#pragma once
#include "Component/Component.hpp"
#include "Models/Callback.hpp"
#include "Wal.hpp"
#include "Component/Renderer/Drawable2DComponent.hpp"
namespace BBM
{
//! @brief A Stat component which contains a text and a callback
class StatComponent : public WAL::Component
{
public:
//! @brief onEvent callback
WAL::Callback<Drawable2DComponent &> updater;
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override;
//! @brief Create a new StatComponent with a callback
StatComponent(WAL::Entity &entity, WAL::Callback<Drawable2DComponent &> callback);
//! @brief A color component is copy constructable
StatComponent(const StatComponent &) = default;
//! @brief A default destructor
~StatComponent() override = default;
//! @brief A color component is not assignable
StatComponent &operator=(const StatComponent &) = delete;
};
} // namespace WAL