souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
TextTexture Struct Reference

#include <TextTexture.hpp>

Inheritance diagram for TextTexture:
TextureComponent Component

Public Member Functions

 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.
 
- Public Member Functions inherited from TextureComponent
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
 
- Public Member Functions inherited from Component
void SetGameObject (std::weak_ptr< GameObject > ent)
 Sets the GameObject this component is attached to.
 
std::shared_ptr< GameObjectGetGameObject ()
 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 Public Member Functions

static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 
- Static Public Member Functions inherited from TextureComponent
static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 
- Static Public Member Functions inherited from Component
static ComponentType GetType ()
 Returns the type of this component to make querying GetComponent easier.
 

Additional Inherited Members

- Protected Attributes inherited from TextureComponent
std::shared_ptr< SDL_Texture > mTexture
 
SDL_FRect * mSrcRect
 
- Protected Attributes inherited from Component
std::weak_ptr< GameObjectmGameObject
 

Detailed Description

Component for rendering a string to the screen. The texture will only be computed once per frame, when calling Render()

Member Function Documentation

◆ 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,aThe 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
fontPathThe file path for the font asset
ptsizeThe font size to use

◆ SetText()

void TextTexture::SetText ( std::string text)

Sets the message to render to the screen

Parameters
textThe 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: