-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthpackview.cpp
48 lines (43 loc) · 1013 Bytes
/
healthpackview.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
#include "healthpackview.h"
#include <QTimer>
HealthPackView::HealthPackView()
{
setPixmap(QPixmap(":/images/HP_1.png").scaled(50,50,Qt::KeepAspectRatio));
timer = new QTimer();
connect(timer, SIGNAL(timeout()), this, SLOT(updates()));
timer->start(120);
}
HealthPackView::~HealthPackView()
{
delete timer;
}
// Animation
void HealthPackView::updates()
{
switch (nrOfPic) {
case 1:{
setPixmap(QPixmap(":/images/HP_1.png").scaled(50,50,Qt::KeepAspectRatio));
nrOfPic=4;
break;
}
case 2:{
setPixmap(QPixmap(":/images/HP_4.png").scaled(50,50,Qt::KeepAspectRatio));
nrOfPic-=1;
break;
}
case 3:{
setPixmap(QPixmap(":/images/HP_3.png").scaled(50,50,Qt::KeepAspectRatio));
nrOfPic-=1;
break;
}
case 4:{
setPixmap(QPixmap(":/images/HP_2.png").scaled(50,50,Qt::KeepAspectRatio));
nrOfPic-=1;
break;
}
}
}
void HealthPackView::used_slot()
{
this->hide();
}