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

The translucent veil painted behind a dialog or a modal drawer to dim the rest of the scene. More...

#include <headers/guillaume/entities/backdrop.hpp>

Inheritance diagram for guillaume::entities::Backdrop:
Collaboration diagram for guillaume::entities::Backdrop:

Public Member Functions

 ~Backdrop (void) override=default
 Destructor.
void setVisible (bool visible)
 Show or hide the backdrop.
bool isVisible (void) const
 Check whether the backdrop is shown.
void follow (const utility::graphic::PoseF &ownerPose, float ownerWidth, float ownerHeight)
 Centre the backdrop on its owner, half a layer behind it.
Public Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Scrim, components::Animation, components::Backdrop >
 EntityFiller (ComponentRegistry &componentRegistry)
 Create the entity, its listed components and its components::Hierarchy.
virtual ~EntityFiller (void)=default
 Destroy the entity object; its components stay in the registry (see EntityRegistry::removeEntity).
Public Member Functions inherited from guillaume::ecs::Entity
 Entity (void)
 Create an entity with a fresh identifier, an empty signature, no parent and no component.
virtual ~Entity (void)=default
 Destroy the entity object.
Entity::Identifier getIdentifier (void) const noexcept
 Get the identifier of the entity.
Entity::Signature getSignature (void) const noexcept
 Get the set of component types the entity declares.
void setSignature (const Signature &signature)
 Replace the signature of the entity.
std::int32_t getLayer (void) const noexcept
 Get the depth of the entity in the tree.
Entity & setParent (std::shared_ptr< Entity > parent)
 Attach the entity under another one, or detach it.
std::vector< Identifier > releaseComponents (void)
 Drop the entity's place in the tree and all its components.
std::shared_ptr< Entity > getParent (void) const noexcept
 Get the parent entity.

Static Public Member Functions

template<typename... Arguments>
static std::shared_ptr< Backdrop > create (Arguments &&...arguments)
 Build a hidden backdrop without registering it in an entity registry.
Static Public Member Functions inherited from guillaume::ecs::Entity
template<InheritFromComponent... ComponentTypes>
static Signature getSignatureFromTypes (void)
 Build the signature that has exactly the bits of the given component types.

Static Public Attributes

static constexpr float Extent = systems::Backdrop::Extent
 Side of the backdrop quad, in dp.
Static Public Attributes inherited from guillaume::ecs::Entity
static constexpr Identifier InvalidIdentifier
 "No entity": never the identifier of a real entity

Additional Inherited Members

Public Types inherited from guillaume::ecs::Entity
using Identifier = std::size_t
 The key under which an entity's components are stored. Systems and components refer to entities by this value.
using Signature = std::bitset<128>
 A set of component types, one bit per type (bit position given by ComponentTypeId, MaxComponentTypes bits).
Protected Member Functions inherited from guillaume::ecs::EntityFiller< components::Transform, components::Bound, components::Scrim, components::Animation, components::Backdrop >
ComponentRegistry & getComponentRegistry (void)
 Get the registry that stores this entity's components.
Protected Member Functions inherited from guillaume::ecs::Entity
void attachHierarchy (ComponentRegistry &componentRegistry)
 Give the entity a components::Hierarchy in a registry and add that component to its signature.
template<InheritFromComponent... ComponentTypes>
void setSignature (void)
 Replace the signature by the one made of the given component types.

Detailed Description

The translucent veil painted behind a dialog or a modal drawer to dim the rest of the scene.

Backdrop is a leaf widget: it has no children. Its state lives in components::Backdrop (visibility and fade-in progress); systems::Backdrop turns it into the color of components::Scrim each frame, in the Layout phase, and systems::ScrimRender draws the quad. components::Animation drives the fade-in: it lasts the Medium2 motion duration of the theme, with the enter easing. The class itself holds no field.

Applications rarely create one: Dialog and NavigationDrawer each build their own backdrop, and their systems show, hide and place it every frame. Backdrop has no Builder; Backdrop::create(registry) is the only way to build one.

auto backdrop = Backdrop::create(registry);
backdrop->setParent(owner);
backdrop->follow(ownerPose, ownerWidth, ownerHeight);
backdrop->setVisible(true);
static std::shared_ptr< Backdrop > create(Arguments &&...arguments)
Build a hidden backdrop without registering it in an entity registry.
Definition backdrop.hpp:100

Watch out:

  • The quad is Extent dp wide and high, so that it covers any viewport. follow() must be called again when the owner moves or changes size.
  • Hiding is immediate: only showing is animated.
  • create() does not register the backdrop: add it to an entity registry, or keep the returned pointer alive.
See also
components::Backdrop, systems::Backdrop, Dialog

Definition at line 78 of file backdrop.hpp.

Member Function Documentation

◆ create()

template<typename... Arguments>
std::shared_ptr< Backdrop > guillaume::entities::Backdrop::create ( Arguments &&... arguments)
inlinestatic

Build a hidden backdrop without registering it in an entity registry.

The arguments are forwarded to the private constructor: (registry). A backdrop has no children to build.

Template Parameters
ArgumentsThe constructor argument types.
Parameters
argumentsThe constructor arguments, as listed above.
Returns
The new backdrop. The caller owns it.

Definition at line 100 of file backdrop.hpp.

◆ follow()

void guillaume::entities::Backdrop::follow ( const utility::graphic::PoseF & ownerPose,
float ownerWidth,
float ownerHeight )

Centre the backdrop on its owner, half a layer behind it.

Writes the pose of components::Transform once; the backdrop does not track the owner afterwards.

Parameters
ownerPoseThe pose of the owner (its top-left corner). The backdrop takes its orientation.
ownerWidthThe width of the owner, in dp.
ownerHeightThe height of the owner, in dp.

Definition at line 68 of file backdrop.cpp.

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

◆ isVisible()

bool guillaume::entities::Backdrop::isVisible ( void ) const

Check whether the backdrop is shown.

Returns
True from the moment setVisible(true) is called, even while the fade-in is still running.

Definition at line 61 of file backdrop.cpp.

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

◆ setVisible()

void guillaume::entities::Backdrop::setVisible ( bool visible)

Show or hide the backdrop.

Showing restarts the fade-in from transparent. Hiding stops the animation and makes the backdrop transparent at once. The Scrim color is updated before the call returns. Passing the current visibility does nothing.

Parameters
visibleTrue to show the backdrop, false to hide it.

Definition at line 55 of file backdrop.cpp.

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

Member Data Documentation

◆ Extent

float guillaume::entities::Backdrop::Extent = systems::Backdrop::Extent
staticconstexpr

Side of the backdrop quad, in dp.

Definition at line 87 of file backdrop.hpp.


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