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

A portion of a ring: the moving part of a circular progress or loading indicator. More...

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

Inheritance diagram for guillaume::components::Arc:
Collaboration diagram for guillaume::components::Arc:

Public Types

using SegmentCount = int
 A number of straight segments.

Public Member Functions

 Arc (void)
 Construct a half circle: 8 dp thick, starting at angle 0, covering pi radians, drawn with 48 segments.
 ~Arc (void)=default
 Default destructor for the Arc component.
float getThickness (void) const
 Get the thickness of the arc.
Arc & setThickness (float thickness)
 Set the thickness of the arc.
float getStartAngle (void) const
 Get the angle the arc starts at.
Arc & setStartAngle (float startAngle)
 Set the angle the arc starts at.
float getSweepAngle (void) const
 Get the angle the arc covers.
Arc & setSweepAngle (float sweepAngle)
 Set the angle the arc covers from its start angle.
SegmentCount getSegments (void) const
 Get how many straight segments approximate the arc.
Arc & setSegments (SegmentCount segments)
 Set how many straight segments approximate the arc.
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

A portion of a ring: the moving part of a circular progress or loading indicator.

The outer edge of the arc is the ellipse inscribed in the entity's components::Bound; the arc is thickness wide towards the center, starts at startAngle and covers sweepAngle. Its ends are flat.

Written by systems::ProgressIndicator and systems::LoadingIndicator, every frame while they animate, or by the application. Read by systems::ArcRender in the Render phase, with the entity's Transform, Bound and Color (the color of the arc).

// The first quarter of a circle, starting at 12 o'clock.
const float pi = 3.14159265f;
registry.getComponent<components::Arc>(id)
.setThickness(4.0f)
.setStartAngle(-pi / 2.0f)
.setSweepAngle(pi / 2.0f);
A portion of a ring: the moving part of a circular progress or loading indicator.
Definition arc.hpp:59
Arc & setStartAngle(float startAngle)
Set the angle the arc starts at.
Definition arc.cpp:55
Arc & setThickness(float thickness)
Set the thickness of the arc.
Definition arc.cpp:40
Arc & setSweepAngle(float sweepAngle)
Set the angle the arc covers from its start angle.
Definition arc.cpp:70
Note
Angles are in radians. Angle 0 points to the right (3 o'clock) and, as Y grows downwards, a positive angle turns clockwise on screen: -pi / 2 is 12 o'clock.
See also
systems::ArcRender, components::Ring for a full ring

Definition at line 58 of file arc.hpp.

Member Typedef Documentation

◆ SegmentCount

A number of straight segments.

Definition at line 61 of file arc.hpp.

Constructor & Destructor Documentation

◆ Arc()

guillaume::components::Arc::Arc ( void )
explicit

Construct a half circle: 8 dp thick, starting at angle 0, covering pi radians, drawn with 48 segments.

Definition at line 27 of file arc.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ getSegments()

Arc::SegmentCount guillaume::components::Arc::getSegments ( void ) const

Get how many straight segments approximate the arc.

Returns
The segment count over the whole sweep (48 by default).

Definition at line 80 of file arc.cpp.

◆ getStartAngle()

float guillaume::components::Arc::getStartAngle ( void ) const

Get the angle the arc starts at.

Returns
The start angle, in radians (0, pointing right, by default).

Definition at line 50 of file arc.cpp.

◆ getSweepAngle()

float guillaume::components::Arc::getSweepAngle ( void ) const

Get the angle the arc covers.

Returns
The sweep, in radians (pi, a half circle, by default).

Definition at line 65 of file arc.cpp.

◆ getThickness()

float guillaume::components::Arc::getThickness ( void ) const

Get the thickness of the arc.

Returns
The distance between its outer and inner edges, in dp (8 by default).

Definition at line 35 of file arc.cpp.

◆ setSegments()

Arc & guillaume::components::Arc::setSegments ( SegmentCount segments)

Set how many straight segments approximate the arc.

More segments give a smoother curve for more triangles. Marks the component changed only when the value differs.

Parameters
segmentsThe segment count over the whole sweep; systems::ArcRender draws at least 1.
Returns
This component, for chaining.

Definition at line 85 of file arc.cpp.

Here is the call graph for this function:

◆ setStartAngle()

Arc & guillaume::components::Arc::setStartAngle ( float startAngle)

Set the angle the arc starts at.

Marks the component changed only when the value differs.

Parameters
startAngleThe start angle, in radians; 0 points right and -pi / 2 points up.
Returns
This component, for chaining.

Definition at line 55 of file arc.cpp.

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

◆ setSweepAngle()

Arc & guillaume::components::Arc::setSweepAngle ( float sweepAngle)

Set the angle the arc covers from its start angle.

Marks the component changed only when the value differs.

Parameters
sweepAngleThe sweep, in radians: 2 * pi is a full turn, and a positive value turns clockwise on screen.
Returns
This component, for chaining.

Definition at line 70 of file arc.cpp.

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

◆ setThickness()

Arc & guillaume::components::Arc::setThickness ( float thickness)

Set the thickness of the arc.

Marks the component changed only when the value differs.

Parameters
thicknessThe distance between the outer and inner edges, in dp, measured towards the center of the bound.
Returns
This component, for chaining.

Definition at line 40 of file arc.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: