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

A full ring: the outline of a radio button, the track of a circular progress indicator. More...

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

Inheritance diagram for guillaume::components::Ring:
Collaboration diagram for guillaume::components::Ring:

Public Types

using SegmentCount = int
 A number of straight segments.

Public Member Functions

 Ring (void)
 Construct a ring 8 dp thick drawn with 48 segments.
 ~Ring (void)=default
 Default destructor for the Ring component.
float getThickness (void) const
 Get the thickness of the ring.
Ring & setThickness (float thickness)
 Set the thickness of the ring.
SegmentCount getSegments (void) const
 Get how many straight segments approximate the ring.
Ring & setSegments (SegmentCount segments)
 Set how many straight segments approximate the ring.
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 full ring: the outline of a radio button, the track of a circular progress indicator.

The outer edge of the ring is the ellipse inscribed in the entity's components::Bound; the inner edge is thickness closer to the center. A square bound gives a circle.

Written by the widget systems that draw a ring, or by the application. Read by systems::RingRender in the Render phase, with the entity's Transform, Bound and Color (the color of the ring).

registry.getComponent<components::Ring>(id).setThickness(2.0f);
A full ring: the outline of a radio button, the track of a circular progress indicator.
Definition ring.hpp:53
Ring & setThickness(float thickness)
Set the thickness of the ring.
Definition ring.cpp:38
Note
A thickness of half the bound or more fills the ring into a disc.
See also
systems::RingRender, components::Arc for a portion of a ring, components::Ellipse for a filled disc

Definition at line 52 of file ring.hpp.

Member Typedef Documentation

◆ SegmentCount

A number of straight segments.

Definition at line 55 of file ring.hpp.

Constructor & Destructor Documentation

◆ Ring()

guillaume::components::Ring::Ring ( void )
explicit

Construct a ring 8 dp thick drawn with 48 segments.

Definition at line 27 of file ring.cpp.

Here is the caller graph for this function:

Member Function Documentation

◆ getSegments()

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

Get how many straight segments approximate the ring.

Returns
The segment count around the ring (48 by default).

Definition at line 48 of file ring.cpp.

◆ getThickness()

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

Get the thickness of the ring.

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

Definition at line 33 of file ring.cpp.

◆ setSegments()

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

Set how many straight segments approximate the ring.

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

Parameters
segmentsThe segment count around the ring; systems::RingRender draws at least 1.
Returns
This component, for chaining.

Definition at line 53 of file ring.cpp.

Here is the call graph for this function:

◆ setThickness()

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

Set the thickness of the ring.

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 38 of file ring.cpp.

Here is the call graph for this function:

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