guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::components::Transform Class Reference

Where an entity is in space: its pose (position and orientation) and its scale. More...

#include <headers/guillaume/components/transform.hpp>

Inheritance diagram for guillaume::components::Transform:
Collaboration diagram for guillaume::components::Transform:

Public Member Functions

 Transform (void)=default
 Default constructor for the Transform component.
 ~Transform (void)=default
 Default destructor for the Transform component.
Transform & setPose (const utility::graphic::PoseF &pose)
 Move and orient the entity.
Transform & setScale (const utility::graphic::ScaleF &scale)
 Store a scale for the entity.
utility::graphic::PoseF getPose (void) const
 Get where the entity is.
utility::graphic::ScaleF getScale (void) const
 Get the stored scale.
Public Member Functions inherited from guillaume::ecs::Component
bool hasChanged (void) const
 Tell whether a value of the component changed since the flags were last reset (the end of the previous frame).
void setHasChanged (bool hasChanged)
 Raise or lower the changed flag.
 Component (void)=default
 Create a component that is not marked as changed.
virtual ~Component (void)=default
 Virtual destructor, so components can be destroyed through the base class.

Detailed Description

Where an entity is in space: its pose (position and orientation) and its scale.

The position is the top-left corner of the entity's components::Bound, in dp; X grows to the right and Y downwards. The render systems draw the bound from that corner, rotated by the orientation.

Written by whoever places the entity: the application for a root entity, systems::Layout for the children listed in a components::Layout, and each widget system for the children it places itself. Read by every render system, by the hit-testing of the input systems and by systems::Clip.

auto &transform = registry.getComponent<components::Transform>(id);
auto pose = transform.getPose();
pose.setPosition(utility::graphic::PositionF(16.0f, 24.0f, 0.0f));
transform.setPose(pose);
Where an entity is in space: its pose (position and orientation) and its scale.
Definition transform.hpp:64
utility::graphic::PoseF getPose(void) const
Get where the entity is.
Definition transform.cpp:47
Transform & setPose(const utility::graphic::PoseF &pose)
Move and orient the entity.
Definition transform.cpp:27
Note
The pose of a child arranged by systems::Layout is overwritten every frame; move its parent instead. Such a child is also pushed towards the viewer, in steps of systems::Layout::LayerDepthStep, so it is drawn in front of its parent: its depth is not its parent's.
No system of the library reads the scale: the render systems draw the bound at its own size.
See also
components::Bound, systems::Layout, systems::RectangleRender

Definition at line 63 of file transform.hpp.

Member Function Documentation

◆ getPose()

utility::graphic::PoseF guillaume::components::Transform::getPose ( void ) const

Get where the entity is.

Returns
A copy of the pose: the position of the top-left corner of the bound, in dp, and the orientation.

Definition at line 47 of file transform.cpp.

Here is the caller graph for this function:

◆ getScale()

utility::graphic::ScaleF guillaume::components::Transform::getScale ( void ) const

Get the stored scale.

Returns
A copy of the scale factor per axis.

Definition at line 52 of file transform.cpp.

◆ setPose()

Transform & guillaume::components::Transform::setPose ( const utility::graphic::PoseF & pose)

Move and orient the entity.

Marks the component changed only when pose differs from the stored one.

Parameters
poseThe position of the top-left corner of the bound, in dp, and the orientation.
Returns
This component, for chaining.

Definition at line 27 of file transform.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setScale()

Transform & guillaume::components::Transform::setScale ( const utility::graphic::ScaleF & scale)

Store a scale for the entity.

Marks the component changed only when scale differs from the stored one. The systems of the library do not apply it.

Parameters
scaleThe scale factor per axis.
Returns
This component, for chaining.

Definition at line 37 of file transform.cpp.

Here is the call graph for this function:

The documentation for this class was generated from the following files: