mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 13:55:10 +00:00
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
//
|
|
// Created by Louis Auzuret on 06/03/21
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include "Models/Callback.hpp"
|
|
#include "Component/Component.hpp"
|
|
#include "Entity/Entity.hpp"
|
|
|
|
namespace BBM
|
|
{
|
|
class ButtonComponent : public WAL::Component
|
|
{
|
|
public:
|
|
//! @brief onIdle callback
|
|
WAL::Callback<> onIdle;
|
|
|
|
//! @brief onHover callback
|
|
WAL::Callback<> onHover;
|
|
|
|
//! @brief onClick callback, when the mouse button is released
|
|
WAL::Callback<> onClick;
|
|
|
|
//! @brief onHold callback, when the mouse button is pressed
|
|
WAL::Callback<> onHold;
|
|
|
|
|
|
//! @inherit
|
|
WAL::Component *clone(WAL::Entity &entity) const override;
|
|
|
|
//! @brief Initialize a new Button component.
|
|
explicit ButtonComponent(WAL::Entity &entity);
|
|
|
|
//! @brief Constructor with the 3 callback
|
|
ButtonComponent(WAL::Entity &entity, WAL::Callback<> idleCallback, WAL::Callback<> hoverCallback, WAL::Callback<> clickCallback, WAL::Callback<> holdCallback);
|
|
|
|
//! @brief Constructor with the 3 std functions
|
|
ButtonComponent(WAL::Entity &entity, std::function<void()> idleCallback, std::function<void()> hoverCallback, std::function<void()> clickCallback, std::function<void()> holdCallback);
|
|
|
|
//! @brief A Controllable component is copy constructable.
|
|
ButtonComponent(const ButtonComponent &) = default;
|
|
//! @brief default destructor
|
|
~ButtonComponent() override = default;
|
|
//! @brief A Button component default assign operator
|
|
ButtonComponent &operator=(const ButtonComponent &) = default;
|
|
};
|
|
} |