-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhealthview.cpp
More file actions
29 lines (25 loc) · 766 Bytes
/
Copy pathhealthview.cpp
File metadata and controls
29 lines (25 loc) · 766 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
#include "healthview.h"
HealthView::HealthView(QPixmap pm, std::shared_ptr<Scene>vPass, std::shared_ptr<HealthModel> mPass):
QGraphicsPixmapItem(pm)
{
view = vPass;
mHealth = mPass;
}
void HealthView::addToScene(){
this->setScale(0.00390625);
this->setPos(mHealth->getXPos(),mHealth->getYPos());
this->setZValue(2);
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
view->addItem(this);
text = std::make_shared<QGraphicsTextItem>();
text->setScale(0.00390625*2);
text->setZValue(2);
text->setPos(mHealth->getXPos(),mHealth->getYPos());
text->setPlainText(QString::number(mHealth->getValue()));
view->addItem(text.get());
}
void HealthView::healthUsed()
{
view->removeItem(this);
delete this;
}