#include <TextTexture.hpp>
|
| TextTexture (std::string fontPath, int ptsize, SDL_Color color) |
| Constructs the TextTexture with a font and color ahead.
|
|
void | SetFont (std::string fontPath, int ptsize) |
|
void | SetText (std::string text) |
|
void | SetColor (int r, int g, int b, int a) |
|
void | SizeTransformToTexture () |
|
void | Render () |
| Renders the text to the screen.
|
|
void | CreateTexture (std::string filepath) |
|
void | SelectSourceRect (float x, float y, float w, float h) |
|
void | ClearSourceRect () |
| Selects the entire texture to render to the screen.
|
|
void | Input () override |
| Called once per frame to handle any new input.
|
|
void | Update (float dt) override |
|
void | Render () override |
|
void | SetGameObject (std::weak_ptr< GameObject > ent) |
| Sets the GameObject this component is attached to.
|
|
std::shared_ptr< GameObject > | GetGameObject () |
| Retrieves the GameObject this component is attached to, behind a shared pointer.
|
|
template<typename T > |
std::shared_ptr< T > | GetComponent () |
| Alias for GetGameObject()->GetComponent<T>() , for easier scripting.
|
|
|
static ComponentType | GetType () |
| Returns the type of this component to make querying GetComponent easier.
|
|
static ComponentType | GetType () |
| Returns the type of this component to make querying GetComponent easier.
|
|
static ComponentType | GetType () |
| Returns the type of this component to make querying GetComponent easier.
|
|
|
std::shared_ptr< SDL_Texture > | mTexture |
|
SDL_FRect * | mSrcRect |
|
std::weak_ptr< GameObject > | mGameObject |
|
Component for rendering a string to the screen. The texture will only be computed once per frame, when calling Render()
◆ GetType()
ComponentType TextTexture::GetType |
( |
| ) |
|
|
static |
Returns the type of this component to make querying GetComponent
easier.
◆ Render()
void TextTexture::Render |
( |
| ) |
|
|
virtual |
Renders the text to the screen.
Reimplemented from Component.
◆ SetColor()
void TextTexture::SetColor |
( |
int | r, |
|
|
int | g, |
|
|
int | b, |
|
|
int | a ) |
Sets the color of the text being rendered
- Parameters
-
r,g,b,a | The RGBA components of the color |
◆ SetFont()
void TextTexture::SetFont |
( |
std::string | fontPath, |
|
|
int | ptsize ) |
Sets the font to use when rendering text to the screen
- Parameters
-
fontPath | The file path for the font asset |
ptsize | The font size to use |
◆ SetText()
void TextTexture::SetText |
( |
std::string | text | ) |
|
Sets the message to render to the screen
- Parameters
-
text | The text to be rendered |
◆ SizeTransformToTexture()
void TextTexture::SizeTransformToTexture |
( |
| ) |
|
Increases or decreases the size of the parent GameObject's transform to exactly fit the text being rendered.
The documentation for this struct was generated from the following files: