A Text component that displays a score or point value.
More...
#include <Counters.h>
|
| | Points (std::string inStr) |
| | Constructs a Points counter.
|
| |
| void | update () override |
| | Updates the displayed text if the point value has changed.
|
| |
| void | reload () override |
| | Resets the points value to its initial state.
|
| |
| | Text (std::string inStr, int x, int y, float scale, SDL_Color color) |
| | Constructs a fully customized Text component.
|
| |
| | Text (std::string inStr, int x, int y, float scale) |
| | Constructs a Text component with a default color.
|
| |
| | Text (std::string inStr, int x, int y) |
| | Constructs a Text component with a default color and scale.
|
| |
| | Text (std::string inStr, int x, int y, float scale, SDL_Color color) |
| | Constructs a fully customized Text component.
|
| |
| | Text (std::string inStr, int x, int y, float scale) |
| | Constructs a Text component with a default color.
|
| |
| | Text (std::string inStr, int x, int y) |
| | Constructs a Text component with a default color and scale.
|
| |
| void | update () override |
| | Updates the destination rectangle for rendering.
|
| |
| void | draw () override |
| | Draws the text texture to the screen.
|
| |
| void | changeText (std::string text) |
| | Changes the text content and regenerates the texture.
|
| |
| void | centreText (SDL_Rect &parentRect) |
| | Adjusts the text's position to be centered within a parent rectangle.
|
| |
| virtual void | init () |
| | Called once when the component is added to an entity.
|
| |
|
|
int | value |
| | The numerical score value.
|
| |
|
Entity * | entity |
| | Pointer to the entity that owns this component.
|
| |
A Text component that displays a score or point value.
◆ Points()
| Points::Points |
( |
std::string |
inStr | ) |
|
Constructs a Points counter.
- Parameters
-
| inStr | The prefix string to display (e.g., "Score: "). |
◆ reload()
Resets the points value to its initial state.
Reimplemented from Component.
◆ Text() [1/3]
| Text::Text |
( |
std::string |
inStr, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Constructs a Text component with a default color and scale.
- Parameters
-
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |
◆ Text() [2/3]
| Text::Text |
( |
std::string |
inStr, |
|
|
int |
x, |
|
|
int |
y, |
|
|
float |
scale |
|
) |
| |
Constructs a Text component with a default color.
- Parameters
-
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |
| scale | The rendering scale. |
◆ Text() [3/3]
Constructs a fully customized Text component.
- Parameters
-
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |
| scale | The rendering scale. |
| color | The color of the text. |
◆ update()
Updates the displayed text if the point value has changed.
Reimplemented from Component.
The documentation for this struct was generated from the following files: