Rise
The Vieneo Province
Text.cpp
Go to the documentation of this file.
1
#include "
Text.h
"
2
3
Text::Text
(
Logger
* prmLogger,
Bus
* prmBus,
DeviceObject
* prmpDevice, ID3DXFont* prmFont,
int
prmX,
int
prmY,
int
prmWidth,
int
prmHeight)
4
{
5
prmLogger->
AddToCallStack
(
"Text::ctor"
);
6
7
logger
= prmLogger;
8
pDevice
= prmpDevice;
9
pFont
= prmFont;
10
bus
= prmBus;
11
x
= prmX;
12
y
= prmY;
13
width
= prmWidth;
14
height
= prmHeight;
15
16
rect
.top =
y
;
17
if
(
height
)
18
rect
.bottom =
rect
.top +
height
;
19
else
20
rect
.bottom = 0;
21
rect
.left =
x
;
22
if
(
width
)
23
rect
.right =
rect
.left +
width
;
24
else
25
rect
.right = 0;
26
27
const
float
z
= 1.0f;
// on top of everything
28
transform
= D3DXMATRIX(
29
1.0f, 0.0f, 0.0f, 0.0f,
30
0.0f, 1.0f, 0.0f, 0.0f,
31
0.0f, 0.0f, 1.0f, 0.0f,
32
0.0f, 0.0f,
z
, 1.0f);
33
}
34
35
void
Text::Draw
(WCHAR* str)
36
{
37
logger
->
AddToCallStack
(
"Text::Draw"
);
38
HRESULT hr;
39
D3DXCOLOR newcolor;
40
//if (bus->IsDim(elementName))
41
// newcolor = color * 0.5f;
42
//else
43
newcolor =
color
;
44
45
V(
pDevice
->
pSprite
->SetTransform(&
transform
));
46
47
if
(FAILED(hr =
pFont
->DrawTextW(
pDevice
->
pSprite
, str, -1, &
rect
,
flags
, newcolor)))
48
{
49
logger
->
Log
(
"Text::DrawText DrawText failed!"
,
Logger::Fatal
, hr);
50
}
51
}
Text::color
D3DXCOLOR color
Definition:
Text.h:64
Text::x
int x
Definition:
Text.h:62
Text::rect
RECT rect
Definition:
Text.h:52
Text::width
int width
Definition:
Text.h:65
Logger
Definition:
Logger.h:9
Text::bus
Bus * bus
Definition:
Text.h:54
Text::pDevice
DeviceObject * pDevice
Definition:
Text.h:55
Bus
Definition:
Bus.h:16
Logger::Fatal
Definition:
Logger.h:26
Text::Draw
void Draw(WCHAR *str)
Definition:
Text.cpp:35
DeviceObject
Definition:
DeviceObject.h:7
Text::z
float z
Definition:
Text.h:63
Text.h
Logger::Log
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition:
Logger.cpp:11
Text::height
int height
Definition:
Text.h:65
Text::pFont
ID3DXFont * pFont
Definition:
Text.h:57
Text::transform
D3DXMATRIX transform
Definition:
Text.h:58
Text::logger
Logger * logger
Definition:
Text.h:53
Logger::AddToCallStack
void AddToCallStack(const char *msg)
Definition:
Logger.cpp:86
DeviceObject::pSprite
LPD3DXSPRITE pSprite
Definition:
DeviceObject.h:21
Text::flags
int flags
Definition:
Text.h:66
Text::y
int y
Definition:
Text.h:62
Text::Text
Text(Logger *prmLogger, Bus *prmBus, DeviceObject *prmpDevice, ID3DXFont *prmFont, int prmX, int prmY, int prmWidth, int prmHeight)
Definition:
Text.cpp:3
Displays
Text.cpp
Generated on Tue May 4 2021 15:18:14 for Rise by
1.8.14