23#include "guillaume/systems/backdrop.hpp"
28#include "guillaume/systems/layout.hpp"
29#include "guillaume/theme.hpp"
46 const float alpha = state.isVisible()
47 ?
static_cast<float>(backdrop.getAlpha()) * state.getProgress()
51 .setColor(backdrop.withAlpha(
52 static_cast<std::uint8_t
>(std::lround(alpha))));
61 if (state.isVisible() == visible) {
69 animation.setElapsed(0.0f).play();
73 apply(componentRegistry, entityIdentifier);
78 const utility::graphic::PoseF &ownerPose,
79 float ownerWidth,
float ownerHeight)
81 const auto &orientation = ownerPose.getOrientation();
82 utility::graphic::PositionF position = ownerPose.getPosition();
83 position.translate(utility::graphic::PositionF(
84 -(orientation.getRight() * ((
Extent - ownerWidth) / 2.0f))
85 - (orientation.getUp() * ((
Extent - ownerHeight) / 2.0f))
89 .setPose(utility::graphic::PoseF(position, orientation));
A timer that runs from 0 to a duration and reports its eased progress, from 0 to 1,...
State of a modal backdrop, the dimming layer behind a dialog or a drawer: whether it is shown and how...
Backdrop & setProgress(float progress)
Set the fade-in progress. Called by the entity's fade animation on every sample.
Backdrop & setVisible(bool visible)
Store whether the backdrop is shown.
A translucent veil drawn over the whole bound of its entity, to dim what is behind a modal surface.
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
ComponentType & getComponent(const Entity::Identifier &entityIdentifier)
Get a component of an entity, to read or modify it.
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 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...
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 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.
Backdrop(void)
Create the system in the Layout phase.
static constexpr float Extent
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...
Arranges the children of a container in a row or a column and sizes the container around them.
static constexpr float LayerDepthStep
Depth of one layer: the distance a child is moved towards the viewer, against the forward axis of its...
State. Every class here is plain data attached to an entity.
The entity-component-system core, independent of any widget.
Rules. Every class here runs each frame on the entities that have the components it declares.
@ Backdrop
Modal backdrop behind dialogs and drawers.
utility::graphic::Color32Bit getActiveColor(SchemeColorRole role)
Get the color the active scheme gives to a role.