-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCText.cpp
More file actions
58 lines (41 loc) · 1.18 KB
/
CText.cpp
File metadata and controls
58 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "CText.h"
#include "CApplication.h"
#include <string>
TTF_Font* CText::sFontSmall = NULL;
TTF_Font* CText::sFontLarge = NULL;
SDL_Color CText::cBlack = { 0, 0, 0 };
SDL_Color CText::cRed = { 255, 0, 0 };
CText::CText() : CTexture()
{
mText = "";
DropShadow = false;
DropTex = new CTexture();
}
void CText::SetText(TTF_Font* font, std::string textureText, SDL_Color textColor, int w, int h, HAlignment halign)
{
SDL_Renderer* renderer = CApplication::sRenderer;
mText = textureText;
//printf("CText::SetText: %s\n", textureText.c_str());
LoadFromRenderedText(renderer, font, textureText, textColor, w, h, halign);
if (DropShadow)
{
SDL_Color clr = { 0, 0, 0 };
DropTex->LoadFromRenderedText(renderer, font, textureText, clr);
}
}
void CText::SetText(TTF_Font* font, std::string textureText, SDL_Color textColor)
{
SDL_Renderer* renderer = CApplication::sRenderer;
mText = textureText;
//printf("CText::SetText: %s\n", textureText.c_str());
LoadFromRenderedText(renderer, font, textureText, textColor);
if (DropShadow)
{
SDL_Color clr = { 0, 0, 0 };
DropTex->LoadFromRenderedText(renderer, font, textureText, clr);
}
}
void CText::Draw()
{
CTexture::Draw();
}