Platformer
Platformer
Public Member Functions | Private Attributes | List of all members
TextRenderComponent Class Reference

A TextRenderComponent class. More...

#include <TextRenderComponent.hpp>

Inheritance diagram for TextRenderComponent:
Inheritance graph
Collaboration diagram for TextRenderComponent:
Collaboration graph

Public Member Functions

 TextRenderComponent (SDL_Color color)
 Constructs a TextRenderComponent. More...
 
 TextRenderComponent (SDL_Color color, std::string text)
 Constructs a TextRenderComponent. More...
 
void ChangeText (const std::string newText)
 Changes the text of this TextRenderComponent. More...
 
- Public Member Functions inherited from RenderComponent
 RenderComponent ()
 Constructs a new RenderComponent.
 
virtual void Update () override
 Updates this component.
 
virtual void Render ()
 Renders this component based on the given camera.
 
- Public Member Functions inherited from Component
void SetParentGameObject (std::weak_ptr< GameObject > g)
 Sets the given GameObject as this component's parent. More...
 
virtual void Init ()
 Initializes this component.
 
std::shared_ptr< GameObjectGetGameObject ()
 Gets a shared ptr reference to this component's GameObject. More...
 

Private Attributes

SDL_Color color
 The color of this TextRenderComponent.
 
std::shared_ptr< SDLFontWrapperfont
 The font of this TextRenderComponent.
 
const std::string FONT_PATH
 The font path of this TextRenderComponent. More...
 

Additional Inherited Members

- Public Attributes inherited from RenderComponent
SDL_RendererFlip renderFlip = SDL_FLIP_NONE
 Whether the renderer should be flipped.
 
- Protected Attributes inherited from RenderComponent
std::shared_ptr< SDLTextureWrappertexture
 The texture for this RenderComponent.
 
std::shared_ptr< SDL_Rect > renderSrc
 The source rect to be used, null if the whole texture is used.
 
- Protected Attributes inherited from Component
std::weak_ptr< GameObjectgameObject
 This component's parent GameObject.
 

Detailed Description

A TextRenderComponent class.

This represents a simple renderable piece of text within our game, having a font, color, and functionality to change its text.

Constructor & Destructor Documentation

◆ TextRenderComponent() [1/2]

TextRenderComponent::TextRenderComponent ( SDL_Color  color)

Constructs a TextRenderComponent.

Parameters
colorThe color of this TextRenderComponent
Here is the call graph for this function:

◆ TextRenderComponent() [2/2]

TextRenderComponent::TextRenderComponent ( SDL_Color  color,
std::string  text 
)

Constructs a TextRenderComponent.

Parameters
colorThe color of this TextRenderComponent
textThe initial text
Here is the call graph for this function:

Member Function Documentation

◆ ChangeText()

void TextRenderComponent::ChangeText ( const std::string  newText)

Changes the text of this TextRenderComponent.

Parameters
newTextThe string of text to be changed to
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ FONT_PATH

const std::string TextRenderComponent::FONT_PATH
private
Initial value:
=
FullAssetsPath() + "Fonts/raleway/Raleway-Bold.ttf"

The font path of this TextRenderComponent.


The documentation for this class was generated from the following files: