-
Notifications
You must be signed in to change notification settings - Fork 0
/
wall.cpp
87 lines (72 loc) · 1.53 KB
/
wall.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
79
80
81
82
83
84
85
86
87
#include "wall.h"
void Wall::AddWall(int r_number,
int x, int y,
int r_status,
QLabel &r_label,
QPixmap &r_pixmap)
{
this->SetCoordinates(x, y);
number = r_number;
x_wposition = x;
y_wposition = y;
status = r_status;
w_label = &r_label;
w_label->setPixmap(r_pixmap);
w_pixmap = &r_pixmap;
w_label->repaint();
w_label->show();
}
void Wall::SetNumber(int l_number)
{
number = l_number;
}
int Wall::GetNumber( )
{
return number;
}
void Wall::SetCoordinates(int x, int y)
{
x_wposition = x;
y_wposition = y;
}
void Wall::SetStatus(int l_status)
{
status = l_status;
}
int Wall::GetStatus()
{
return status;
}
void Wall::Repaint()
{
}
void Wall::SetLabel(QLabel &l_label)
{
w_label = &l_label;
}
void Wall::SetPixmap(QPixmap &l_pixmap)
{
w_pixmap = &l_pixmap;
w_label->setPixmap(*w_pixmap);
w_label->repaint();
}
void Wall::Struck(void)
{
QPixmap wall_destroyed(":/images/wall_destroyed.png");
QPixmap tank_destroyed(":/images/tank_destroyed.png");
QPixmap wall(":/images/wall.png");
QPixmap ground(":/images/ground.png");
QPixmap target(":/images/target.png");
if (status==2)
w_label->setPixmap(wall_destroyed);
else if (status==1)
w_label->setPixmap(ground);
status--;
w_label->repaint();
if (status==3 || number == 0) // target
{
status = 0;
w_label->setPixmap(tank_destroyed);
w_label->repaint();
}
}