Rise
The Vieneo Province
Loading...
Searching...
No Matches
Text.cpp
Go to the documentation of this file.
1#include "Text.h"
2
3Text::Text(Logger* prmLogger, Bus* prmBus, DeviceObject* prmpDevice, Rendering::RenderFont* 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
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
35void Text::Draw(WCHAR* str)
36{
37 logger->AddToCallStack("Text::Draw");
38 HRESULT hr;
39 RiseMath::Color newcolor;
40 //if (bus->IsDim(elementName))
41 // newcolor = color * 0.5f;
42 //else
43 newcolor = color;
44
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}
#define V(expression)
HRESULT(WINAPI *CUniBuffer::_ScriptApplyDigitSubstitution)(const SCRIPT_DIGITSUBSTITUTE *
Definition Bus.h:20
Rendering::RenderSprite * pSprite
void Log(const char *msg, Level level=Info, int errorCode=0)
Definition Logger.cpp:283
void AddToCallStack(const char *msg)
Definition Logger.cpp:355
@ Fatal
Definition Logger.h:29
INT DrawTextW(RenderSprite *sprite, const wchar_t *text, INT count, RECT *rectangle, DWORD flags, PackedColor color)
HRESULT SetTransform(const RiseMath::Matrix *value)
int flags
Definition Text.h:66
int x
Definition Text.h:62
float z
Definition Text.h:63
RECT rect
Definition Text.h:52
int width
Definition Text.h:65
RiseMath::Color color
Definition Text.h:64
Logger * logger
Definition Text.h:53
DeviceObject * pDevice
Definition Text.h:55
Bus * bus
Definition Text.h:54
int y
Definition Text.h:62
RiseMath::Matrix transform
Definition Text.h:58
void Draw(WCHAR *str)
Definition Text.cpp:35
Text(Logger *prmLogger, Bus *prmBus, DeviceObject *prmpDevice, Rendering::RenderFont *prmFont, int prmX, int prmY, int prmWidth, int prmHeight)
Definition Text.cpp:3
int height
Definition Text.h:65
Rendering::RenderFont * pFont
Definition Text.h:57