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

Configures Image widgets and registers them in the scene's entity registry. More...

#include <headers/guillaume/entities/image.hpp>

Inheritance diagram for guillaume::entities::Image::Builder:
Collaboration diagram for guillaume::entities::Image::Builder:

Public Member Functions

 Builder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder holding the defaults of reset().
std::shared_ptr< Image > buildEntity (void) override
 Build an image from the current configuration, without registering it or giving it a parent.
void reset (void) override
 Restore the defaults: empty texture path, no fallback texture, and no size (width and height 0).
Builder & withTexturePath (const std::string &texturePath)
 Choose the texture to draw.
Builder & withFallbackPath (const std::string &fallbackPath)
 Set the texture drawn when the main one fails to load.
Builder & withSize (float width, float height)
 Set the displayed size.
std::shared_ptr< Image > makeImage (std::shared_ptr< Entity > parent, const std::string &texturePath)
 Build an image, register it under parent and reset the builder.
Public Member Functions inherited from guillaume::entities::EntityBuilderBase< Image >
 EntityBuilderBase (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Construct a builder bound to two registries.
 ~EntityBuilderBase (void) override=default
 Default destructor.
std::shared_ptr< Image > registerEntity (std::shared_ptr< ecs::Entity > parent)
 Build the widget, attach it to its parent, hand it to the entity registry, then reset the builder to its defaults.
Public Member Functions inherited from guillaume::ecs::EntityBuilder
 EntityBuilder (ecs::ComponentRegistry &componentRegistry, ecs::EntityRegistry &entityRegistry)
 Create a builder working on a pair of registries, normally those of one scene.
virtual ~EntityBuilder (void)=default
 Virtual destructor.

Additional Inherited Members

Protected Member Functions inherited from guillaume::ecs::EntityBuilder
ComponentRegistry & getComponentRegistry (void)
 Get the registry in which the builder creates components.
EntityRegistry & getEntityRegistry (void)
 Get the registry in which the builder registers the entities it creates.

Detailed Description

Configures Image widgets and registers them in the scene's entity registry.

Definition at line 83 of file image.hpp.

Constructor & Destructor Documentation

◆ Builder()

guillaume::entities::Image::Builder::Builder ( ecs::ComponentRegistry & componentRegistry,
ecs::EntityRegistry & entityRegistry )

Construct a builder holding the defaults of reset().

Parameters
componentRegistryThe registry the components of the built images are stored in.
entityRegistryThe registry that owns the images built by makeImage.
Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ buildEntity()

std::shared_ptr< Image > guillaume::entities::Image::Builder::buildEntity ( void )
overridevirtual

Build an image from the current configuration, without registering it or giving it a parent.

The size is applied only when both the width and the height are positive.

Returns
The new image.

Implements guillaume::entities::EntityBuilderBase< Image >.

Definition at line 39 of file image.cpp.

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

◆ makeImage()

std::shared_ptr< Image > guillaume::entities::Image::Builder::makeImage ( std::shared_ptr< Entity > parent,
const std::string & texturePath )

Build an image, register it under parent and reset the builder.

The fallback path and size set with the with... methods apply to the built image.

Parameters
parentThe entity the image is attached to, or nullptr for a root entity.
texturePathThe path of the texture file to draw.
Returns
The registered image.

Definition at line 80 of file image.cpp.

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

◆ reset()

void guillaume::entities::Image::Builder::reset ( void )
overridevirtual

Restore the defaults: empty texture path, no fallback texture, and no size (width and height 0).

Implements guillaume::ecs::EntityBuilder.

Definition at line 50 of file image.cpp.

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

◆ withFallbackPath()

Image::Builder & guillaume::entities::Image::Builder::withFallbackPath ( const std::string & fallbackPath)

Set the texture drawn when the main one fails to load.

Parameters
fallbackPathThe path of the fallback texture file. Empty by default, which means no fallback.
Returns
Reference to this builder for chaining.

Definition at line 59 of file image.cpp.

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

◆ withSize()

Image::Builder & guillaume::entities::Image::Builder::withSize ( float width,
float height )

Set the displayed size.

Unlike Image::setSize(), this never throws: the built image keeps the Bound it was created with unless both values are positive.

Parameters
widthThe displayed width, in dp. 0 by default.
heightThe displayed height, in dp. 0 by default.
Returns
Reference to this builder for chaining.

Definition at line 65 of file image.cpp.

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

◆ withTexturePath()

Image::Builder & guillaume::entities::Image::Builder::withTexturePath ( const std::string & texturePath)

Choose the texture to draw.

Parameters
texturePathThe path of the texture file, as the resource provider of the application resolves it. Empty by default.
Returns
Reference to this builder for chaining.

Definition at line 73 of file image.cpp.

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

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