forked from abdallahabdelaziz1/PacmanGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext.cpp
More file actions
61 lines (47 loc) · 1.27 KB
/
text.cpp
File metadata and controls
61 lines (47 loc) · 1.27 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
59
60
#include "text.h"
text::text()
{
arcade=new QFont("Emulogic", 12);
setFont(*arcade);
display = "READY!";
setPlainText(display);
setPos(13*20, 17*20); //13*blockdim, 18*blockdim
setDefaultTextColor(QColor(254, 232, 0));
gameovertimer=new QTimer(this);
connect(gameovertimer, SIGNAL(timeout()),this, SLOT(ChangeToRepeat()));
wintimer=new QTimer(this);
connect(wintimer, SIGNAL(timeout()), this, SLOT(ChangeToContinue()));
}
void text::lost(){
display = "GAME OVER";
setDefaultTextColor(Qt::red);
setPlainText(display);
setPos(11*20, 17*20); //11*blockdim, 18*blockdim
gameovertimer->start(2000);
}
void text::ChangeToRepeat()
{
display = "Again? Y\\N";
setDefaultTextColor(QColor(254, 232, 0));
setPlainText(display);
setPos(10*20, 17*20);
gameovertimer->stop();
}
void text::won()
{
display = "You Won!";
setDefaultTextColor(Qt::red);
setPlainText(display);
setPos(11*20, 17*20); //11*blockdim, 18*blockdim
wintimer->start(2000);
}
void text::ChangeToContinue()
{
display = "Continue? Y\\N";
arcade->setPointSize(9);
setFont(*arcade);
setDefaultTextColor(QColor(254, 232, 0));
setPlainText(display);
setPos(10*20+2, 17*20);
wintimer->stop();
}