27#include <utility/graphic/size.hpp>
29#include "guillaume/ecs/component.hpp"
63 std::function<void(
void)>;
65 std::function<void(
void)>;
70 bool _isHovered {
false };
72 utility::graphic::SizeUI _accessibilityMargin {
HoverHandler getOnHoverHandler(void) const
Get the callback run when the pointer enters the entity.
MouseHoverInteraction & setHovered(bool isHovered)
Record whether the pointer is over the entity.
UnhoverHandler getOnUnhoverHandler(void) const
Get the callback run when the pointer leaves the entity.
MouseHoverInteraction & setOnUnhoverHandler(const UnhoverHandler &handler)
Store the callback run when the pointer leaves the entity.
std::function< void(void)> UnhoverHandler
Called on hover end.
MouseHoverInteraction(void)
Construct a component that is not hovered, has no handler and no margin.
utility::graphic::SizeUI getAccessibilityMargin(void) const
Get the hit area added around the bound.
bool isHovered(void) const
Check whether the pointer is over the entity.
MouseHoverInteraction & setAccessibilityMargin(const utility::graphic::SizeUI &margin)
Grow the hit area past the bound without growing the entity on screen.
std::function< void(void)> HoverHandler
Called on hover start.
~MouseHoverInteraction(void)=default
Default destructor.
MouseHoverInteraction & setOnHoverHandler(const HoverHandler &handler)
Store the callback run when the pointer enters the entity.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
State. Every class here is plain data attached to an entity.