-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdialogText.cpp
More file actions
58 lines (50 loc) · 1.21 KB
/
dialogText.cpp
File metadata and controls
58 lines (50 loc) · 1.21 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 "stdafx.h"
#include "dialogText.h"
dialogText::dialogText(wstring str, int type)
: _str(str), _type(type)
{
}
HRESULT dialogText::init()
{
if (_type % 2 == 0)
{
// ¿ÞÂÊ
_img = IMAGEMANAGER->addImage("left d", L"images/UI/left-2.png");
_rc = RectMakePivot(Vector2(300, 800), Vector2(500, 120), pivot::LEFTTOP);
}
else
{
_img = IMAGEMANAGER->addImage("right d", L"images/UI/right-2.png");
_rc = RectMakePivot(Vector2(700, 800), Vector2(500, 120), pivot::LEFTTOP);
}
return S_OK;
}
void dialogText::release()
{
}
void dialogText::update()
{
_textCount++;
if (_textCount % 2 == 0)
{
if (_textIndex < _str.size())
{
_textIndex++;
SOUNDMANAGER->play("dialog");
}
}
}
void dialogText::render()
{
_img->render(_rc.getCenter());
wstring temp = L"";
for (int i = 0; i <= _textIndex; ++i)
{
temp += _str[i];
}
if (_type % 2 == 0)
D2DRENDERER->RenderTextField(_rc.getCenter().x + 40, _rc.getCenter().y, temp, 30, _rc.getSize().x, _rc.getSize().y, D2DRenderer::DefaultBrush::White);
else
D2DRENDERER->RenderTextField(_rc.getCenter().x + 20, _rc.getCenter().y, temp, 30, _rc.getSize().x, _rc.getSize().y, D2DRenderer::DefaultBrush::White);
//D2DRENDERER->AddTextBoldFormat(_str, 30);
}