mosue management

This commit is contained in:
arthur.jamet
2021-06-15 17:59:45 +02:00
parent eb65c73fbc
commit 8a4c3fa586
5 changed files with 68 additions and 12 deletions
@@ -7,11 +7,14 @@
#include "Component/Controllable/ControllableComponent.hpp"
#include "Models/Vector2.hpp"
#include "System/System.hpp"
#include "Component/Position/PositionComponent.hpp"
#include "Component/Renderer/Drawable2DComponent.hpp"
#include "Component/Button/ButtonComponent.hpp"
namespace BBM
{
//! @brief A system to handle Controllable entities in a menu.
class MenuControllableSystem : public WAL::System<ControllableComponent>
class MenuControllableSystem : public WAL::System<>
{
private:
//! @brief index of the current button selected
@@ -21,11 +24,13 @@ namespace BBM
//! @param selected lets know if te new selected button is 'pressed'
void _updateCurrentButton(bool selected, Vector2f move);
//! @return true if mouse on entity
bool _mouseOnButton(WAL::ViewEntity<OnClickComponent, OnHoverComponent, OnIdleComponent, PositionComponent, Drawable2DComponent> &entity) const;
public:
//! @brief time (in millisecond) since last check
std::chrono::time_point<std::chrono::steady_clock> now;
//! @inherit
void onFixedUpdate(WAL::ViewEntity<ControllableComponent> &entities) override;
void onSelfUpdate() override;
//! @brief A default constructor
explicit MenuControllableSystem(WAL::Wal &wal);