-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.cpp
More file actions
30 lines (25 loc) · 710 Bytes
/
Point.cpp
File metadata and controls
30 lines (25 loc) · 710 Bytes
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
#include "Point.h"
Point::Point(QWidget *parent, int x, int y, bool isSuper_) : QWidget(parent)
{
position = new QPoint(x, y);
imgLabel = new QLabel(this);
this->isSuper = isSuper_;
QString imageFile;
if (isSuper)
{
imageFile = QString("pacman-art/other/strawberry.png");
}
else
{
imageFile = QString("pacman-art/other/dot.png");
}
QPixmap image(imageFile);
imgLabel->setPixmap(image);
this->setGeometry(x * gap_size * scale, y * gap_size * scale, image.width(), image.height());
}
void Point::kill()
{
position->setX(-1);
position->setY(-1);
this->move(position->x() * scale * gap_size, position->y() * scale * gap_size);
}