23#include "guillaume/systems/focus_ring_render.hpp"
27#include "guillaume/components/borders.hpp"
28#include "guillaume/mesh_renderable.hpp"
29#include "guillaume/systems/rectangle_render.hpp"
31#include "guillaume/theme.hpp"
63 if (!state.isFocused()) {
75 radius = (borders.getTopLeftRadius() + borders.getTopRightRadius()
76 + borders.getBottomRightRadius()
77 + borders.getBottomLeftRadius())
81 constexpr float grow =
83 const float halfWidth = bound.getWidth() / 2.0f + grow;
84 const float halfHeight = bound.getHeight() / 2.0f + grow;
85 const float outerRadius = radius > 0.0f ? radius + grow : 0.0f;
87 const utility::graphic::PositionF lift(
89 const utility::graphic::PositionF center(
90 pose.getPosition().x + bound.getWidth() / 2.0f + lift[0],
91 pose.getPosition().y - bound.getHeight() / 2.0f + lift[1],
92 pose.getPosition().z + lift[2]);
94 utility::graphic::Mesh mesh(std::vector<utility::graphic::VertexF> {},
95 std::vector<uint32_t> {});
97 mesh, center, pose.getOrientation(), halfWidth, halfHeight,
103 if (mesh.getVertices().empty()) {
107 auto renderable = std::make_shared<MeshRenderable>(
108 std::vector<utility::graphic::Mesh> { mesh },
"mesh_material");
111 if (handle ==
nullptr) {
113 RenderHandle { _engine.createObject(renderable), renderable,
116 if (!_engine.updateObject(renderable, handle->objectId)) {
117 handle->objectId = _engine.createObject(renderable);
119 handle->renderable = renderable;
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)
bool hasComponent(const ecs::Entity::Identifier &entityIdentifier) const
Tell whether an entity has a component, in the bound registry.
ComponentType & getComponent(const ecs::Entity::Identifier &entityIdentifier)
Get a component of an entity from the bound registry, to read or modify it.
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...
void prepare(void) override
Mark every ring as not drawn yet. Called once per frame before the entities are visited.
void cleanup(void) override
Remove the rings that were not drawn this frame, which is how an entity that lost the focus loses its...
void update(const ecs::Entity::Identifier &entityIdentifier) override
Draw the ring of one entity if it is focused, creating the engine object on the first frame and updat...
FocusRingRender(utility::Engine &engine)
Create the system in the Render phase.
static constexpr float StrokeLift
Distance the border is moved towards the viewer, along the forward axis of the entity,...
void insert(const ecs::Entity::Identifier &identifier, RenderHandle handle)
Store the handle of an entity, replacing the one it had.
void markAllUnused(void)
Clear the used flag of every handle. Call it from the system's prepare(), before any entity is drawn.
void removeUnused(utility::Engine &engine)
Remove from the engine, then from the map, every handle whose used flag is still false....
RenderHandle * find(const ecs::Entity::Identifier &identifier)
Look up the handle of an entity.
Summarizes the input state of an entity into its components::StyleState, the one component widget sys...
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.
utility::graphic::Color32Bit getActiveColor(SchemeColorRole role)
Get the color the active scheme gives to a role.
Mesh builders shared by the shape render systems.
void buildRoundedStrokeMesh(utility::graphic::Mesh &mesh, const utility::graphic::PositionF ¢er, const utility::graphic::OrientationF &orientation, float halfWidth, float halfHeight, float radius, float width, int arcSegments, const utility::graphic::Color32Bit &color)
Build the border of a rounded rectangle as a band of constant width.
What a render system remembers about the engine object it created for one entity.
static constexpr float Width
Ring thickness, in dp.
static constexpr float Offset
Gap between the bound and the ring, in dp.