|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Tracks which entities the mouse pointer is over. More...
#include <headers/guillaume/systems/mouse_motion.hpp>


Public Member Functions | |
| MouseMotion (event::EventBus &eventBus, utility::Engine &engine) | |
| Create the system, in the Event phase, and subscribe it to mouse motion events. | |
| ~MouseMotion (void) | |
| Destructor. | |
| void | prepare (void) override |
| Take the next pending mouse motion event, once per frame. | |
| void | cleanup (void) override |
| Does nothing. | |
| virtual void | update (const ecs::Entity::Identifier &entityIdentifier) override |
| Test the pointer against one entity and update its hovered flag. | |
| Public Member Functions inherited from guillaume::ecs::SystemFiller< components::MouseHoverInteraction, components::Transform, components::Bound > | |
| SystemFiller (Phase phase) | |
| Create the system and set its signature from ComponentTypes. | |
| virtual | ~SystemFiller (void)=default |
| Virtual destructor. | |
| Public Member Functions inherited from guillaume::ecs::System | |
| System (Phase phase) | |
| Create a system that runs in a given phase, with an empty signature. | |
| virtual | ~System (void)=default |
| Virtual destructor. | |
| Phase | getPhase (void) const noexcept |
| Get the phase of the frame in which the system runs. | |
| Entity::Signature | getSignature (void) const noexcept |
| Get the component types an entity must declare to be visited by this system. | |
| void | routine (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry, const ecs::EntityTreeTraveler &traveler) |
| Run the system once over a scene: prepare(), update() on each matching entity, cleanup(). | |
| void | bindComponentRegistry (ecs::ComponentRegistry &componentRegistry) |
| Bind a component registry so update() can be called directly, without routine(). | |
| void | unbindComponentRegistry (void) |
| Drop the binding made by bindComponentRegistry(). | |
| Public Member Functions inherited from guillaume::event::EventManager< utility::event::MouseMotionEvent > | |
| EventManager (EventBus &eventBus) | |
| Subscribe to a bus; events of type EventType published after this call are queued. | |
| virtual | ~EventManager (void)=default |
| Virtual destructor. | |
| bool | hasPendingEvents (void) const |
| Tell whether at least one event is queued, waiting for consumeNextEvent(). | |
Additional Inherited Members | |
| Protected Member Functions inherited from guillaume::ecs::System | |
| template<InheritFromComponent... ComponentTypes> | |
| void | setSignature (void) |
| Replace the signature by the one made of the given component types. | |
| ecs::EntityRegistry & | getEntityRegistry (void) |
| Get the entity registry of the scene being processed. | |
| const ecs::EntityRegistry & | getEntityRegistry (void) const |
| Get the entity registry of the scene being processed, read-only. | |
| ecs::ComponentRegistry & | getComponentRegistry (void) |
| Get the component registry of the scene being processed. | |
| const ecs::ComponentRegistry & | getComponentRegistry (void) const |
| Get the component registry of the scene being processed, read-only. | |
| template<InheritFromComponent ComponentType> | |
| bool | hasComponent (const ecs::Entity::Identifier &entityIdentifier) const |
| Tell whether an entity has a component, in the bound registry. | |
| template<InheritFromComponent ComponentType> | |
| ComponentType & | getComponent (const ecs::Entity::Identifier &entityIdentifier) |
| Get a component of an entity from the bound registry, to read or modify it. | |
| template<InheritFromComponent ComponentType> | |
| const ComponentType & | getComponent (const ecs::Entity::Identifier &entityIdentifier) const |
| Get a component of an entity from the bound registry, read-only. | |
| template<InheritFromComponent ComponentType> | |
| bool | requireComponent (const ecs::Entity::Identifier &entityIdentifier) |
| Tell whether an entity has a component, and log a warning naming the entity and the component when it does not. | |
| Protected Member Functions inherited from guillaume::event::EventManager< utility::event::MouseMotionEvent > | |
| void | consumeNextEvent (void) |
| Take the oldest queued event and make it the last event. | |
| std::shared_ptr< EventType > | getLastEvent (void) |
| Get the event taken by the most recent consumeNextEvent() that found one. | |
Tracks which entities the mouse pointer is over.
Runs in the Event phase on entities that have a components::MouseHoverInteraction, a Transform and a Bound. It turns the position of the current mouse motion event into a world ray (through the engine's view) and tests it against the rectangle of the entity, grown by its accessibility margin. It writes the hovered flag of components::MouseHoverInteraction and calls its hover handler when the pointer enters and its unhover handler when it leaves. A disabled entity is never hovered.
Every entity is tested on its own: when two entities overlap under the pointer, both are hovered. Nothing is tested until a first mouse motion event has been received.
Definition at line 60 of file mouse_motion.hpp.
| guillaume::systems::MouseMotion::MouseMotion | ( | event::EventBus & | eventBus, |
| utility::Engine & | engine ) |
Create the system, in the Event phase, and subscribe it to mouse motion events.
| eventBus | The event bus delivering the mouse motion events. |
| engine | The engine whose view converts the pointer position into a world ray. It must outlive the system. |
Definition at line 28 of file mouse_motion.cpp.

| guillaume::systems::MouseMotion::~MouseMotion | ( | void | ) |
Destructor.
Definition at line 37 of file mouse_motion.cpp.
|
overridevirtual |
Does nothing.
Reimplemented from guillaume::ecs::System.
Definition at line 46 of file mouse_motion.cpp.
|
overridevirtual |
Take the next pending mouse motion event, once per frame.
When none is pending, the previous event stays the current one.
Reimplemented from guillaume::ecs::System.
Definition at line 41 of file mouse_motion.cpp.

|
overridevirtual |
Test the pointer against one entity and update its hovered flag.
Calls the hover or unhover handler when the flag changes. When the view cannot convert the pointer position (it throws std::out_of_range), a warning is logged and the entity is left as it was.
| entityIdentifier | The entity holding the components::MouseHoverInteraction. |
Implements guillaume::ecs::System.
Definition at line 50 of file mouse_motion.cpp.
