souleng
Game engine providing full Python scripting support
Loading...
Searching...
No Matches
TextTexture.hpp
1#include <string>
2#include <SDL3_ttf/SDL_ttf.h>
3#include <SDL3/SDL_pixels.h>
4
5#include "ComponentType.hpp"
6#include "components/TextureComponent.hpp"
7
12
14 TextTexture(std::string fontPath, int ptsize, SDL_Color color);
15
17
21 void SetFont(std::string fontPath, int ptsize);
22
25 void SetText(std::string text);
26
29 void SetColor(int r, int g, int b, int a);
30
34
36 void Render();
37
39 static ComponentType GetType();
40
41private:
42 bool dirty{true};
43 std::shared_ptr<TTF_Font> mFont;
44 std::string mText;
45 SDL_Color mColor;
46 int mWidth{32};
47 int mHeight{32};
48};
Definition TextTexture.hpp:10
void Render()
Renders the text to the screen.
Definition TextTexture.cpp:51
void SetColor(int r, int g, int b, int a)
Definition TextTexture.cpp:36
static ComponentType GetType()
Returns the type of this component to make querying GetComponent easier.
Definition TextTexture.cpp:74
void SetText(std::string text)
Definition TextTexture.cpp:31
void SizeTransformToTexture()
Definition TextTexture.cpp:41
void SetFont(std::string fontPath, int ptsize)
Definition TextTexture.cpp:24
Component to render an image to the screen.
Definition TextureComponent.hpp:9