A component that renders a string of text on the screen. More...
#include <Text.h>


Public Member Functions | |
| 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. | |
Public Member Functions inherited from Component | |
| virtual void | init () |
| Called once when the component is added to an entity. | |
| virtual void | reload () |
| Called to reset the component's state. | |
Protected Member Functions | |
| void | setTex (const char *text) |
| Creates a new texture from a string of text. | |
Protected Attributes | |
| std::string | data |
| float | scale |
| SDL_Texture * | textTex |
| SDL_Colour | textColour |
| SDL_Rect | destRect |
Additional Inherited Members | |
Public Attributes inherited from Component | |
| Entity * | entity |
| Pointer to the entity that owns this component. | |
A component that renders a string of text on the screen.
Wraps SDL_ttf to create a texture from a string and displays it.
Constructs a fully customized Text component.
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |
| scale | The rendering scale. |
| color | The color of the text. |

Constructs a Text component with a default color.
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |
| scale | The rendering scale. |

Constructs a Text component with a default color and scale.
| inStr | The initial string to display. |
| x | The x-position. |
| y | The y-position. |

Adjusts the text's position to be centered within a parent rectangle.
| parentRect | The rectangle to center within. |

| void Text::changeText | ( | std::string | text | ) |
Changes the text content and regenerates the texture.
| text | The new string to display. |
|
overridevirtual |
Draws the text texture to the screen.
Reimplemented from Component.

Creates a new texture from a string of text.
| text | The string to render. |


|
overridevirtual |
Updates the destination rectangle for rendering.
Reimplemented from Component.
