mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 13:55:10 +00:00
some buttons for the settings menu
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user