Skip to main content

MaxScoreObserverComponent Class

Component that observes and caches the high score value from a ScorePool. More...

Declaration

class helios::engine::mechanics::scoring::components::MaxScoreObserverComponent { ... }

Friends Index

classhelios::engine::mechanics::scoring::systems::MaxScoreObserverClearSystem

Public Constructors Index

MaxScoreObserverComponent ()=default
MaxScoreObserverComponent (const MaxScoreObserverComponent &other)

Copy constructor. More...

MaxScoreObserverComponent (MaxScoreObserverComponent &&) noexcept=default

Public Operators Index

MaxScoreObserverComponent &operator= (const MaxScoreObserverComponent &)=default
MaxScoreObserverComponent &operator= (MaxScoreObserverComponent &&) noexcept=default

Public Member Functions Index

boolisEnabled () const noexcept

Checks whether this component is enabled. More...

voidenable () noexcept

Enables this component. More...

voiddisable () noexcept

Disables this component. More...

voidsetScorePoolId (const ScorePoolId scorePoolId) noexcept

Sets the score pool to observe. More...

ScorePoolIdscorePoolId () const noexcept

Returns the observed score pool ID. More...

voidsetMaxScorePoolSnapshot (const helios::engine::mechanics::scoring::MaxScorePoolSnapshot &snapshot) noexcept

Sets the cached snapshot value. More...

ScorePoolRevisionscorePoolRevision () const noexcept

Returns the cached score pool revision. More...

doublemaxScore () const noexcept

Returns the cached max score. More...

boolhasUpdate () const noexcept

Checks if the value changed since last clear. More...

Private Member Functions Index

voidclearUpdate ()

Clears the update flag. More...

Private Member Attributes Index

ScorePoolIdscorePoolId_ {helios::core::types::no_init}

ID of the score pool to observe. More...

boolhasUpdate_ = true

Flag indicating whether the value changed this frame. More...

MaxScorePoolSnapshotsnapshot_

the current snapshot saved by this observer component. More...

boolisEnabled_ = true

Whether this component is enabled. More...

Description

Component that observes and caches the high score value from a ScorePool.

Attached to UI entities to display high score values. The MaxScoreObserverUpdateSystem updates this component's snapshot from the referenced ScorePool each frame. The hasUpdate flag indicates when the value has changed.

See Also

MaxScoreObserverUpdateSystem

See Also

MaxScoreObserverClearSystem

See Also

MaxScorePoolSnapshot

Definition at line 35 of file MaxScoreObserverComponent.ixx.

Friends

helios::engine::mechanics::scoring::systems::MaxScoreObserverClearSystem

Public Constructors

MaxScoreObserverComponent()

helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::MaxScoreObserverComponent ()
default

MaxScoreObserverComponent()

helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::MaxScoreObserverComponent (const MaxScoreObserverComponent & other)
inline

Copy constructor.

Parameters
other

The component to copy from.

Definition at line 106 of file MaxScoreObserverComponent.ixx.

107 scorePoolId_(other.scorePoolId_) {}

Reference MaxScoreObserverComponent.

MaxScoreObserverComponent()

helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::MaxScoreObserverComponent (MaxScoreObserverComponent &&)
noexcept default

Definition at line 110 of file MaxScoreObserverComponent.ixx.

Reference MaxScoreObserverComponent.

Public Operators

operator=()

MaxScoreObserverComponent & helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::operator= (const MaxScoreObserverComponent &)
default

Definition at line 109 of file MaxScoreObserverComponent.ixx.

Reference MaxScoreObserverComponent.

operator=()

MaxScoreObserverComponent & helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::operator= (MaxScoreObserverComponent &&)
noexcept default

Definition at line 111 of file MaxScoreObserverComponent.ixx.

Reference MaxScoreObserverComponent.

Public Member Functions

disable()

void helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::disable ()
inline noexcept

Disables this component.

Definition at line 95 of file MaxScoreObserverComponent.ixx.

95 void disable() noexcept {
96 isEnabled_ = false;
97 }

enable()

void helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::enable ()
inline noexcept

Enables this component.

Definition at line 88 of file MaxScoreObserverComponent.ixx.

88 void enable() noexcept {
89 isEnabled_ = true;
90 }

hasUpdate()

bool helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::hasUpdate ()
inline nodiscard noexcept

Checks if the value changed since last clear.

Returns

True if the value was updated this frame.

Definition at line 169 of file MaxScoreObserverComponent.ixx.

169 [[nodiscard]] bool hasUpdate() const noexcept {
170 return hasUpdate_;
171 }

isEnabled()

bool helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::isEnabled ()
inline nodiscard noexcept

Checks whether this component is enabled.

Returns

True if enabled, false otherwise.

Definition at line 81 of file MaxScoreObserverComponent.ixx.

81 [[nodiscard]] bool isEnabled() const noexcept {
82 return isEnabled_;
83 }

maxScore()

double helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::maxScore ()
inline nodiscard noexcept

Returns the cached max score.

Returns

The current high score value.

Definition at line 160 of file MaxScoreObserverComponent.ixx.

160 [[nodiscard]] double maxScore() const noexcept {
161 return snapshot_.maxScore;
162 }

scorePoolId()

ScorePoolId helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::scorePoolId ()
inline nodiscard noexcept

Returns the observed score pool ID.

Returns

The ScorePoolId.

Definition at line 127 of file MaxScoreObserverComponent.ixx.

127 [[nodiscard]] ScorePoolId scorePoolId() const noexcept {
128 return scorePoolId_;
129 }

Referenced by setScorePoolId.

scorePoolRevision()

ScorePoolRevision helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::scorePoolRevision ()
inline nodiscard noexcept

Returns the cached score pool revision.

Returns

The revision of the last observed snapshot.

Definition at line 151 of file MaxScoreObserverComponent.ixx.

151 [[nodiscard]] ScorePoolRevision scorePoolRevision() const noexcept {
152 return snapshot_.revision;
153 }

setMaxScorePoolSnapshot()

void helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::setMaxScorePoolSnapshot (const helios::engine::mechanics::scoring::MaxScorePoolSnapshot & snapshot)
inline noexcept

Sets the cached snapshot value.

Sets hasUpdate to true if the value changes.

Parameters
snapshot

The snapshot to use for the next update.

Definition at line 138 of file MaxScoreObserverComponent.ixx.

139 if (snapshot_.revision == snapshot.revision) {
140 return;
141 }
142 snapshot_ = snapshot;
143 hasUpdate_ = true;
144 }

setScorePoolId()

void helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::setScorePoolId (const ScorePoolId scorePoolId)
inline noexcept

Sets the score pool to observe.

Parameters
scorePoolId

The ID of the pool to observe.

Definition at line 118 of file MaxScoreObserverComponent.ixx.

118 void setScorePoolId(const ScorePoolId scorePoolId) noexcept {
119 scorePoolId_ = scorePoolId;
120 }

References scorePoolId and setScorePoolId.

Referenced by setScorePoolId.

Private Member Functions

clearUpdate()

void helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::clearUpdate ()
inline

Clears the update flag.

Called by MaxScoreObserverClearSystem.

Definition at line 70 of file MaxScoreObserverComponent.ixx.

70 void clearUpdate() {
71 hasUpdate_ = false;
72 }

Private Member Attributes

hasUpdate_

bool helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::hasUpdate_ = true

Flag indicating whether the value changed this frame.

Cleared by MaxScoreObserverClearSystem at frame end.

Definition at line 53 of file MaxScoreObserverComponent.ixx.

53 bool hasUpdate_ = true;

isEnabled_

bool helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::isEnabled_ = true

Whether this component is enabled.

Definition at line 63 of file MaxScoreObserverComponent.ixx.

63 bool isEnabled_ = true;

scorePoolId_

ScorePoolId helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::scorePoolId_ {helios::core::types::no_init}

ID of the score pool to observe.

Definition at line 45 of file MaxScoreObserverComponent.ixx.

snapshot_

MaxScorePoolSnapshot helios::engine::mechanics::scoring::components::MaxScoreObserverComponent::snapshot_

the current snapshot saved by this observer component.

Definition at line 58 of file MaxScoreObserverComponent.ixx.

58 MaxScorePoolSnapshot snapshot_;

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


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.