dEngine
Simple 2D C++ game engine
Public Member Functions | Protected Attributes | List of all members
dengine_UI::Text Class Reference

Text rendered with TrueTypeFonts. More...

#include <Text.h>

Inheritance diagram for dengine_UI::Text:
dengine_UI::UIComponent

Public Member Functions

void Setup (std::string font, std::string text, SDL_Rect rect)
 
void SetDrawColor (SDL_Color color)
 
void Render () override
 The render method of a component. More...
 
void Update () override
 The update method of a component. More...
 
- Public Member Functions inherited from dengine_UI::UIComponent
void SetDrawColor (SDL_Color color)
 Set Draw Color. More...
 

Protected Attributes

SDL_Rect textRect
 
std::string fontName
 
std::string displayText
 
SDL_Color drawColor
 
- Protected Attributes inherited from dengine_UI::UIComponent
SDL_Color drawColor
 

Additional Inherited Members

- Protected Member Functions inherited from dengine_UI::UIComponent
std::string GetVar (std::string key)
 

Detailed Description

Text rendered with TrueTypeFonts.

Member Function Documentation

◆ Render()

void Text::Render ( )
overridevirtual

The render method of a component.

During the render phase of the program, this function is what draws the component to the screen. This should be overridden for any UIComponents and actually be used to draw to the screen using one of the many SDL_Render functions available.

Implements dengine_UI::UIComponent.

Referenced by SetDrawColor().

◆ SetDrawColor()

void dengine_UI::Text::SetDrawColor ( SDL_Color  color)
inline

◆ Setup()

void Text::Setup ( std::string  font,
std::string  text,
SDL_Rect  rect 
)

Initializes Text to be displayed on screen

Parameters
fontThe name of the font registered with the FontManager
textThe text to display
rectA rect denoting the position of the text
See also
FontManager

◆ Update()

void Text::Update ( )
overridevirtual

The update method of a component.

During the update phase of the program, this function is what updates and performs any logic within the component. This should be overridden for any UIComponents and actually be used to Update the internal logic of the component. This is called prior to the update anywhere else within the engine.

Implements dengine_UI::UIComponent.

Referenced by SetDrawColor().

Member Data Documentation

◆ displayText

std::string dengine_UI::Text::displayText
protected

◆ drawColor

SDL_Color dengine_UI::Text::drawColor
protected

Referenced by SetDrawColor().

◆ fontName

std::string dengine_UI::Text::fontName
protected

◆ textRect

SDL_Rect dengine_UI::Text::textRect
protected