23#include "guillaume/components/loading_indicator.hpp"
34 if (_variant != variant) {
63 if (_indicator != identifier) {
64 _indicator = identifier;
77 if (_built != built) {
91 if (_progress != progress) {
100 return _hidesWhenStopped;
105 if (_hidesWhenStopped != hides) {
106 _hidesWhenStopped = hides;
119 if (_opacity != opacity) {
133 if (_opacityFrom != opacity) {
134 _opacityFrom = opacity;
142 return _opacityTarget;
147 if (_opacityTarget != opacity) {
148 _opacityTarget = opacity;
154 const std::optional<utility::graphic::Color32Bit> &
157 return _indicatorColor;
161 const std::optional<utility::graphic::Color32Bit> &color)
163 if (_indicatorColor != color) {
164 _indicatorColor = color;
State of a loading indicator: an arc that turns, or a bar that slides, in a loop while something is i...
Variant
Shape of the indicator.
LoadingIndicator & setOpacity(float opacity)
Store the opacity the indicator is drawn with.
LoadingIndicator & setHidesWhenStopped(bool hides)
Choose whether the indicator fades out when it is stopped.
LoadingIndicator & setVariant(Variant variant)
Set the shape of the indicator.
float getOpacityFrom(void) const noexcept
Get the opacity the indicator had when the running fade began.
float getSize(void) const noexcept
Get the diameter of the circular variant.
LoadingIndicator & setOpacityTarget(float opacity)
Store the opacity a fade ends at.
float getOpacity(void) const noexcept
Get the opacity the indicator is drawn with.
LoadingIndicator & setOpacityFrom(float opacity)
Store the opacity at the start of a fade.
LoadingIndicator & setBuilt(bool built)
Record whether the animated child matches the current variant.
const std::optional< utility::graphic::Color32Bit > & getIndicatorColor(void) const noexcept
Get the color chosen for the indicator.
float getOpacityTarget(void) const noexcept
Get the opacity the running fade ends at.
LoadingIndicator & setProgress(float progress)
Store how far the loop has advanced.
bool hidesWhenStopped(void) const noexcept
Tell whether the indicator fades out when it is stopped.
bool isBuilt(void) const noexcept
Tell whether the animated child matches the current variant.
float getProgress(void) const noexcept
Get how far the loop has advanced.
LoadingIndicator & setIndicatorColor(const std::optional< utility::graphic::Color32Bit > &color)
Choose the color of the indicator.
ecs::Entity::Identifier getIndicator(void) const noexcept
Get the child that draws the turning arc or the sliding bar.
LoadingIndicator & setIndicator(ecs::Entity::Identifier identifier)
Record the child that draws the turning arc or the sliding bar.
LoadingIndicator(void)=default
Create the state of a circular indicator of the default size, with no child, that hides when stopped.
LoadingIndicator & setSize(float size)
Set the diameter of the circular variant.
Variant getVariant(void) const noexcept
Get the shape of the indicator.
void setHasChanged(bool hasChanged)
Raise or lower the 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.