Render the GameObject on screen as a piece of text.
More...
|
| this (size_t owner, SDL_Renderer *renderer, string fontPath, int fontSize, SDL_Color color, int x, int y) |
| Setup the renderer.
|
|
| ~this () |
| Cleanup texture memory usage.
|
|
override void | Update () |
| Update the background texture.
|
|
override void | Render (SDL_Renderer *renderer, SDL_Rect *camera) |
| Render the text on screen.
|
|
bool | IsVisible (SDL_Rect *camera) |
| Checks whether the GameObject is visible to the camera.
|
|
void | SetText (string newText) |
| Update the text to be displayed.
|
|
|
SDL_Renderer * | mRenderer |
| The SDL renderer object.
|
|
TTF_Font * | mFont |
| The SDL font to use.
|
|
SDL_Color | mColor |
| The color in which to render the text.
|
|
SDL_Texture * | mTexture |
| The texture for the background.
|
|
SDL_Rect | mRect |
| Screen-space rectangle for rendering text.
|
|
string | mText |
| The text to display.
|
|
Render the GameObject on screen as a piece of text.
The render location is defined by ComponentTransform.
- See also
- ComponentTransform
◆ this()
ComponentTextRenderer::this |
( |
size_t | owner, |
|
|
SDL_Renderer * | renderer, |
|
|
string | fontPath, |
|
|
int | fontSize, |
|
|
SDL_Color | color, |
|
|
int | x, |
|
|
int | y ) |
|
inline |
Setup the renderer.
- Parameters
-
owner | the id of the attached GameObject. |
renderer | the SDL renderer object. |
fontPath | path to a TTF file containing the font to use. |
fontSize | the font size to display. |
color | the color of the text. |
x | the horizontal pixel position to display the text. |
y | the vertical pixel position to display the text (0 is the top). |
◆ IsVisible()
bool ComponentTextRenderer::IsVisible |
( |
SDL_Rect * | camera | ) |
|
|
inline |
Checks whether the GameObject is visible to the camera.
- Returns
true
if visible, otherwise false
.
◆ Render()
override void ComponentTextRenderer::Render |
( |
SDL_Renderer * | renderer, |
|
|
SDL_Rect * | camera ) |
|
inline |
Render the text on screen.
- Parameters
-
renderer | the SDL renderer to use. |
camera | the SDL_Rect corresponding to the camera position and size. |
Implements IComponent.
◆ SetText()
void ComponentTextRenderer::SetText |
( |
string | newText | ) |
|
|
inline |
Update the text to be displayed.
- Parameters
-
newText | string to display on screen. |
◆ Update()
override void ComponentTextRenderer::Update |
( |
| ) |
|
|
inline |
Update the background texture.
Implements IComponent.
The documentation for this class was generated from the following file:
- Engine/source/component.d