|
guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
|
Fades the backdrop of a modal widget in and keeps it behind its owner. More...
#include <headers/guillaume/systems/backdrop.hpp>


Public Member Functions | |
| Backdrop (void) | |
| Create the system in the Layout phase. | |
| ~Backdrop (void) override=default | |
| Destroy the system. It owns no resource. | |
| void | update (const ecs::Entity::Identifier &entityIdentifier) override |
| Write the Scrim color of one backdrop for this frame, so a theme change is picked up without any call. | |
| Public Member Functions inherited from guillaume::ecs::SystemFiller< components::Backdrop, components::Scrim > | |
| 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 Scrim color that matches the current state of a backdrop. | |
| static void | setVisible (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, bool visible) |
| Show or hide a backdrop. | |
| static void | follow (ecs::ComponentRegistry &componentRegistry, const ecs::Entity::Identifier &entityIdentifier, const utility::graphic::PoseF &ownerPose, float ownerWidth, float ownerHeight) |
| Center a backdrop on its owner and place it half a layer behind it. | |
Static Public Attributes | |
| static constexpr float | Extent = 8192.0f |
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. | |
Fades the backdrop of a modal widget in and keeps it behind its owner.
A backdrop is the dimmed layer shown behind a dialog or a modal navigation drawer. Its state is a components::Backdrop (shown or not, fade-in progress from 0 to 1); what is drawn is a components::Scrim.
Runs in the Layout phase on entities with Backdrop and Scrim. Each frame it reads the Backdrop and the Backdrop color of the active theme and writes the Scrim color: the theme color with its alpha multiplied by the progress, or fully transparent while the backdrop is hidden. systems::ScrimRender draws the result in the Render phase.
The progress itself is advanced by systems::Animation, through the sample handler that entities::Backdrop installs on its components::Animation.
The static functions are called by the system of the owner (systems::Dialog, systems::NavigationDrawer) when it opens, closes or moves:
There is no fade-out: hiding a backdrop makes it transparent at once.
Definition at line 68 of file backdrop.hpp.
| guillaume::systems::Backdrop::Backdrop | ( | void | ) |
Create the system in the Layout phase.
Definition at line 33 of file backdrop.cpp.


|
static |
Write the Scrim color that matches the current state of a backdrop.
Call it after changing components::Backdrop by hand when the new color must be in place before the next frame.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The backdrop entity. It must have Backdrop and Scrim. |
Definition at line 39 of file backdrop.cpp.


|
static |
Center a backdrop on its owner and place it half a layer behind it.
Writes the backdrop's components::Transform, with the orientation of the owner. The computation assumes the backdrop is Extent wide and high. Call it whenever the owner moves or is resized.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The backdrop entity. It must have a Transform. |
| ownerPose | Pose of the top-left corner of the owner. |
| ownerWidth | Width of the owner, in dp. |
| ownerHeight | Height of the owner, in dp. |
Definition at line 76 of file backdrop.cpp.


|
static |
Show or hide a backdrop.
Showing resets the progress to 0 and starts the fade-in animation from its beginning. Hiding resets the progress, stops the animation and makes the scrim transparent at once. Nothing happens when the backdrop is already in the requested state.
| componentRegistry | The registry holding the components. |
| entityIdentifier | The backdrop entity. It must have Backdrop, Scrim and components::Animation. |
| visible | True to show the backdrop, false to hide it. |
Definition at line 55 of file backdrop.cpp.


|
overridevirtual |
Write the Scrim color of one backdrop for this frame, so a theme change is picked up without any call.
| entityIdentifier | The backdrop entity. |
Implements guillaume::ecs::System.
Definition at line 92 of file backdrop.cpp.

|
staticconstexpr |
Width and height given to a backdrop, in dp: large enough to cover the view wherever its owner is.
Definition at line 74 of file backdrop.hpp.