Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
ContentRect.hpp File Reference

The rectangle a piece of world content occupies: a size, and the point of it the entity's transform sits on. More...

#include "../../core/Types.hpp"
#include "../../core/Reflection.hpp"
#include <glm/glm.hpp>
Include dependency graph for ContentRect.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::ecs::ContentRect
 The rectangle of this entity's content, in its own units. More...

Namespaces

namespace  esengine
namespace  esengine::ecs

Detailed Description

The rectangle a piece of world content occupies: a size, and the point of it the entity's transform sits on.

A Sprite has a size and a pivot, a Text a box and a box pivot, and an entity that draws nothing — a clipping region, a scroll view's viewport, a touch area — has neither. Content laid out as nodes in the world (an imported scene, a hand-built HUD) wants ONE rectangle that all of those read: the renderer sizes its quad by it, the mask clips to it, a pointer is tested against it.

It is not a layout. UINode is the engine's box layout (flex, insets, percentages) and does not go away: this is for content positioned by its Transform, where the box does not depend on its siblings. When an entity has both, the layout's computed box wins for clipping, as before.

A Sprite or Text on the same entity takes its size and pivot from here instead of its own (ContentRectPlugin), so the rectangle is written in one place and the renderers follow it.

Definition in file ContentRect.hpp.