-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCText.cpp
53 lines (38 loc) · 833 Bytes
/
CText.cpp
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
#include "CText.h"
CText::CText() : CAnimate()
{
mTexture = new CTexture();
DropShadow = false;
DropTex = new CTexture();
}
void CText::SetText(SDL_Renderer *renderer, TTF_Font *font, std::string textureText, SDL_Color textColor)
{
if (mTexture != NULL)
{
mTexture->LoadFromRenderedText(renderer, font, textureText, textColor);
if (mTexture != NULL)
{
W = mTexture->GetWidth();
H = mTexture->GetHeight();
}
if (DropShadow)
{
SDL_Color clr = { 0, 0, 0 };
DropTex->LoadFromRenderedText(renderer, font, textureText, clr);
}
}
}
void CText::Draw(SDL_Renderer *renderer)
{
if (mView == true)
{
if (DropTex != NULL)
{
SDL_Rect src;
src = { 0, 0, W, H };
SDL_Rect dst = { mXPos-2, mYPos+2, W, H };
DropTex->Draw(renderer, &src, &dst, 0.0);
}
}
CAnimate::Draw(renderer);
}