27#include "guillaume/ecs/component.hpp"
28#include "guillaume/ecs/entity.hpp"
115 float _spacing { 0.0f };
116 float _padding { 0.0f };
117 bool _hasFixedWidth {
false };
118 bool _hasFixedHeight {
false };
119 float _fixedWidth { 0.0f };
120 float _fixedHeight { 0.0f };
121 std::vector<ecs::Entity::Identifier>
305 const std::vector<ecs::Entity::Identifier> &
getChildren(
void)
const;
317 setChildren(
const std::vector<ecs::Entity::Identifier> &children);
bool hasFixedHeight(void) const
Check whether the container height is forced.
Layout & setFixedWidth(float width)
Force the container width instead of wrapping the children.
CrossAxisAlignment getCrossAxisAlignment(void) const
Get the alignment along the cross axis.
Layout & setChildren(const std::vector< ecs::Entity::Identifier > &children)
Replace the list of children to arrange.
Layout & setAxis(Axis axis)
Choose between a row and a column.
float getSpacing(void) const
Get the gap between two consecutive children.
Layout & setPadding(float padding)
Set the inset between the container's edges and its children.
Layout & setMainAxisAlignment(MainAxisAlignment alignment)
Set where the children go along the main axis.
const std::vector< ecs::Entity::Identifier > & getChildren(void) const
Get the children systems::Layout arranges, in order.
float getPadding(void) const
Get the inset between the container's edges and its children.
Layout(void)=default
Default constructor for the Layout component.
float getFixedWidth(void) const
Get the forced container width.
Layout & clearFixedWidth(void)
Let the width wrap the children again.
CrossAxisAlignment
Where each child goes along the cross axis, inside the padding. In a container that wraps its childre...
Layout & clearFixedHeight(void)
Let the height wrap the children again.
~Layout(void)=default
Default destructor for the Layout component.
float getFixedHeight(void) const
Get the forced container height.
Layout & clearChildren(void)
Empty the list of children; the entities themselves are left untouched.
Layout & setFixedHeight(float height)
Force the container height instead of wrapping the children.
bool hasFixedWidth(void) const
Check whether the container width is forced.
Layout & addChild(ecs::Entity::Identifier child)
Add a child at the end of the list.
MainAxisAlignment getMainAxisAlignment(void) const
Get the alignment along the main axis.
Layout & setCrossAxisAlignment(CrossAxisAlignment alignment)
Set where each child goes along the cross axis.
MainAxisAlignment
Where the children go along the main axis when the container is larger than them.
@ Center
Packed in the middle.
@ End
Packed at the right (row) or bottom (column).
@ Start
Packed at the left (row) or top (column).
Axis getAxis(void) const
Get the main axis.
Axis
Direction along which children are arranged.
@ Vertical
Column: children placed top to bottom.
@ Horizontal
Row: children placed left to right.
Layout & setSpacing(float spacing)
Set the gap between two consecutive children.
Base class of every component: a piece of state attached to an entity, plus a "changed" flag.
std::size_t Identifier
The key under which an entity's components are stored. Systems and components refer to entities by th...
State. Every class here is plain data attached to an entity.