some buttons for the settings menu

This commit is contained in:
arthur.jamet
2021-06-07 17:10:33 +02:00
parent 80afc9a740
commit d41670ae40
2 changed files with 74 additions and 4 deletions

View File

@@ -7,6 +7,7 @@
#include "Models/Callback.hpp"
#include "Component/Component.hpp"
#include "Entity/Entity.hpp"
#include <optional>
namespace BBM
{
@@ -18,6 +19,15 @@ namespace BBM
public:
//! @brief onEvent callback
WAL::Callback<WAL::Entity &> onEvent;
//! @brief button which is at the top of this button
WAL::Entity *_up;
//! @brief button which is below of this button
WAL::Entity *_down;
//! @brief button which is on the right of this button
WAL::Entity *_right;
//! @brief button which is on the left of this button
WAL::Entity *_left;
//! @inherit
WAL::Component *clone(WAL::Entity &entity) const override
@@ -33,9 +43,19 @@ namespace BBM
//! @brief Constructor with the 3 callback
ButtonComponent(WAL::Entity &entity, WAL::Callback<WAL::Entity &> callback)
: WAL::Component(entity),
onEvent(callback)
onEvent(callback), _up(nullptr), _down(nullptr), _left(nullptr), _right(nullptr)
{ }
ButtonComponent &setButtonLinks(WAL::Entity *up = nullptr, WAL::Entity *down = nullptr,
WAL::Entity *left = nullptr, WAL::Entity *right = nullptr)
{
this->_up = up;
this->_down = down;
this->_right = right;
this->_left = left;
return *this;
}
//! @brief A Controllable component is copy constructable.
ButtonComponent(const ButtonComponent<T> &) = default;
//! @brief default destructor