23#include "guillaume/systems/drag.hpp"
64 utility::event::MouseButtonEvent::Button::Left);
73 utility::event::HandButtonEvent::Button::A);
80 const auto position = motionEvent->getPosition();
83 if (!drag.isDragging()) {
84 drag.setLastPosition(position);
85 drag.setDragging(
true);
86 if (
const auto handler = drag.getOnDragStartHandler()) {
92 const auto delta = position - drag.getLastPosition();
93 drag.setLastPosition(position);
95 if (
const auto handler = drag.getOnDragHandler()) {
101 if (drag.isDragging()) {
102 drag.setDragging(
false);
103 if (
const auto handler = drag.getOnDragEndHandler()) {
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
SystemFiller(Phase phase)
ecs::ComponentRegistry & getComponentRegistry(void)
Get the component registry of the scene being processed.
bool hasComponent(const ecs::Entity::Identifier &entityIdentifier) const
Tell whether an entity has a component, in the bound registry.
ComponentType & getComponent(const ecs::Entity::Identifier &entityIdentifier)
Get a component of an entity from the bound registry, to read or modify it.
Hands each engine event to the listeners subscribed to its type.
void consumeNextEvent(void)
EventManager(EventBus &eventBus)
std::shared_ptr< EventType > getLastEvent(void)
Drag(event::EventBus &eventBus)
Create the system, in the Event phase, and subscribe it to mouse motion events.
void update(const ecs::Entity::Identifier &entityIdentifier) override
Start, continue or end the drag of one entity.
void prepare(void) override
Take the next pending mouse motion event, once per frame.
Free functions the input systems share to decide whether a pointer or hand ray hits an entity.
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Delivery of engine events to the systems that subscribed to them.
Rules. Every class here runs each frame on the entities that have the components it declares.
bool isInteractive(const ecs::ComponentRegistry ®istry, const ecs::Entity::Identifier &entityIdentifier)
Whether an entity accepts input.