-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPopUpText.cpp
78 lines (68 loc) · 989 Bytes
/
PopUpText.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "Include/PopUpText.h"
popUpText::popUpText(float d, float i) {
duration = d;
interval = i;
onScreenTimer = 0;
currentLine = 0;
currentPart = 0;
show = false;
flag = false;
startTime = 0;
}
void popUpText::showText()
{
show = true;
startTime = systemTimer.getCurrentTime();
onScreenTimer = duration;
}
void popUpText::hideText()
{
show = false;
startTime = systemTimer.getCurrentTime();
}
bool popUpText::check()
{
systemTimer.calDeltaTime();
tick();
if (!show && systemTimer.getCurrentTime() - startTime > interval)
{
showText();
return true;
}
if (show && onScreenTimer < 0)
{
hideText();
setFlag(false);
return false;
}
if (show)
{
return true;
}
if (!show)
{
return false;
}
}
void popUpText::tick()
{
if (show && onScreenTimer > 0)
{
onScreenTimer -= systemTimer.getDeltaTime();
}
}
bool popUpText::onScreen()
{
if (flag)
{
return true;
}
else
{
return false;
}
}
void popUpText::setFlag(bool f)
{
flag = f;
}