-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathquestbox.cpp
47 lines (35 loc) · 916 Bytes
/
questbox.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
/*
* Author: equati0n
* Date: December 2016
*/
#include "questbox.h"
#include <QPainter>
QuestBox::QuestBox(int length,QGraphicsItem *parent)
: QGraphicsItem(parent)
,mCurrentFrame4(), mLength(length)
{
setFlag(ItemClipsToShape);
mPixmap4 = QPixmap(":images/questbox.png");
}
void QuestBox::nextFrame4(){
mCurrentFrame4 += 50;
if (mCurrentFrame4 >= 800 ) {
mCurrentFrame4 = 0;
//mPos.setX( mPos.x() + 5);
}
}
QRectF QuestBox::boundingRect() const {
return QRectF(0,0,48* mLength,48);
}
void QuestBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(widget);
Q_UNUSED(option);
for(int i = 0; i < 48*mLength; ++i) {
painter->drawPixmap(i*48,0, mPixmap4, mCurrentFrame4, 0,48, 48);
}
setTransformOriginPoint(boundingRect().center());
}
int QuestBox::type() const
{
return Type;
}