guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::systems::Divider Class Reference

Turns the configuration of a divider (a thin horizontal separator line) into the geometry that is drawn. More...

#include <headers/guillaume/systems/divider.hpp>

Inheritance diagram for guillaume::systems::Divider:
Collaboration diagram for guillaume::systems::Divider:

Public Member Functions

 Divider (void)
 Create the system in the Measure phase.
 ~Divider (void) override=default
 Destroy the system. It owns no resource.
void update (const ecs::Entity::Identifier &entityIdentifier) override
 Write the geometry of one divider for this frame.
Public Member Functions inherited from guillaume::ecs::SystemFiller< components::Divider, components::Transform, components::Bound, components::Color, components::Line >
 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().
virtual void prepare (void)
 Called once per pass, before the first update().
virtual void cleanup (void)
 Called once per pass, after the last update().

Static Public Member Functions

static void apply (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
 Write the geometry of one divider from its configuration.

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.

Detailed Description

Turns the configuration of a divider (a thin horizontal separator line) into the geometry that is drawn.

Runs in the Measure phase on entities with Divider, Transform, Bound, Color and Line, so the size is known before the layout.

This is the reference example of the widget shape used across the library: components::Divider holds the state, this system holds the rules, and entities::Divider only creates the entity. The system can be driven on a bare identifier:

registry.getComponent<components::Divider>(divider).setLength(240.0f);
systems::Divider::apply(registry, divider);
State of a divider: a thin horizontal line separating content.
Definition divider.hpp:59
static void apply(ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier)
Write the geometry of one divider from its configuration.
Definition divider.cpp:50

Transform, Bound, the Line thickness and Color of a divider are overwritten every frame: change components::Divider, not them.

See also
components::Divider, entities::Divider
systems::LineRender

Definition at line 65 of file divider.hpp.

Constructor & Destructor Documentation

◆ Divider()

guillaume::systems::Divider::Divider ( void )

Create the system in the Measure phase.

Definition at line 43 of file divider.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ apply()

void guillaume::systems::Divider::apply ( ecs::ComponentRegistry & componentRegistry,
const ecs::Entity::Identifier & entityIdentifier )
static

Write the geometry of one divider from its configuration.

update() calls this every frame. Call it directly when the result is needed before the next frame, for example right after changing the configuration while building a scene.

When the Transform differs from the pose this function applied last (a layout or a scene moved the entity), the divider stays where it was put: the origin stored in components::Divider is recomputed as that position minus the leading inset.

Parameters
componentRegistryThe registry holding the components.
entityIdentifierThe divider entity. It must have Divider, Transform, Bound, Color and Line.
Exceptions
ecs::EntityComponentNotFoundExceptionWhen one of the five components is missing.

Definition at line 50 of file divider.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void guillaume::systems::Divider::update ( const ecs::Entity::Identifier & entityIdentifier)
overridevirtual

Write the geometry of one divider for this frame.

Parameters
entityIdentifierThe divider entity. It is skipped, with a log message, when one of the five components is missing.

Implements guillaume::ecs::System.

Definition at line 83 of file divider.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: