dEngine
Simple 2D C++ game engine
Text.h
Go to the documentation of this file.
1 #ifndef DENGINE_TEXT_H
2 #define DENGINE_TEXT_H
3 
4 #include <SDL.h>
5 #include <SDL_ttf.h>
6 #include "../UIComponent.h"
7 #include "../../System/Game.h"
8 #include "../FontManager.h"
9 
10 namespace dengine_UI {
14  class Text : public UIComponent {
15  public:
23  void Setup(std::string font, std::string text, SDL_Rect rect);
24 
25  void SetDrawColor(SDL_Color color){
26  drawColor = color;
27  }
28 
29  void Render() override;
30  void Update() override;
31 
32  protected:
33  SDL_Rect textRect;
34  std::string fontName;
35  std::string displayText;
36  SDL_Color drawColor;
37 
38  };
39 }
40 #endif //DENGINE_TEXT_H
Text rendered with TrueTypeFonts.
Definition: Text.h:14
SDL_Color drawColor
Definition: Text.h:36
SDL_Rect textRect
Definition: Text.h:33
std::string fontName
Definition: Text.h:34
A component of a UI window.
Definition: UIComponent.h:14
Definition: Circle.h:11
void Setup(std::string font, std::string text, SDL_Rect rect)
Definition: Text.cpp:8
void SetDrawColor(SDL_Color color)
Definition: Text.h:25
void Render() override
The render method of a component.
Definition: Text.cpp:14
void Update() override
The update method of a component.
Definition: Text.cpp:6
std::string displayText
Definition: Text.h:35