guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
backdrop.hpp
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
25#include <utility>
26#include <cstdint>
27#include <memory>
28
29#include <utility/graphic/color.hpp>
30#include <utility/graphic/pose.hpp>
31
32#include "guillaume/components/animation.hpp"
33#include "guillaume/components/backdrop.hpp"
34#include "guillaume/components/bound.hpp"
35#include "guillaume/components/scrim.hpp"
36#include "guillaume/components/transform.hpp"
37#include "guillaume/ecs/component_registry.hpp"
38#include "guillaume/ecs/entity_filler.hpp"
39#include "guillaume/systems/backdrop.hpp"
40
41namespace guillaume::entities
42{
43
78 class Backdrop:
79 public ecs::EntityFiller<components::Transform, components::Bound,
80 components::Scrim, components::Animation,
81 components::Backdrop>
82 {
83 public:
87 static constexpr float Extent = systems::Backdrop::Extent;
88
99 template<typename... Arguments>
100 static std::shared_ptr<Backdrop> create(Arguments &&...arguments)
101 {
102 return std::shared_ptr<Backdrop>(
103 new Backdrop(std::forward<Arguments>(arguments)...));
104 }
105
109 ~Backdrop(void) override = default;
110
120 void setVisible(bool visible);
121
127 bool isVisible(void) const;
128
139 void follow(const utility::graphic::PoseF &ownerPose, float ownerWidth,
140 float ownerHeight);
141
142 private:
150 explicit Backdrop(ecs::ComponentRegistry &registry);
151 };
152
153} // namespace guillaume::entities
Stores every component of a scene, per component type and per entity identifier, and knows which ones...
The base class of a widget without children: an Entity that creates its components when it is constru...
static constexpr float Extent
Side of the backdrop quad, in dp.
Definition backdrop.hpp:87
~Backdrop(void) override=default
Destructor.
bool isVisible(void) const
Check whether the backdrop is shown.
Definition backdrop.cpp:61
void follow(const utility::graphic::PoseF &ownerPose, float ownerWidth, float ownerHeight)
Centre the backdrop on its owner, half a layer behind it.
Definition backdrop.cpp:68
static std::shared_ptr< Backdrop > create(Arguments &&...arguments)
Build a hidden backdrop without registering it in an entity registry.
Definition backdrop.hpp:100
void setVisible(bool visible)
Show or hide the backdrop.
Definition backdrop.cpp:55
static constexpr float Extent
Definition backdrop.hpp:74
Widgets: the classes used to create entities with the right components and children.
Definition app_bar.hpp:46