forked from kn0w0n3/Super_Mario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpiranha.cpp
43 lines (31 loc) · 786 Bytes
/
piranha.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
/*
* Author: equati0n
* Date: December 2016
*/
#include"piranha.h"
#include <QPainter>
Piranha::Piranha(QGraphicsItem *parent)
: QGraphicsItem(parent)
,mCurrentFrame7()
{
setFlag(ItemClipsToShape);
mPixmap7 = QPixmap(":images/piranha.png");
}
void Piranha::nextFrame(){
mCurrentFrame7 += 387;
if (mCurrentFrame7 >= 9286 ) {
mCurrentFrame7 = 0;
}
}
QRectF Piranha::boundingRect() const {
return QRectF(0,0,130,165);
}
void Piranha::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
painter->drawPixmap(0,0, mPixmap7, mCurrentFrame7, 0,130, 165);
setTransformOriginPoint(boundingRect().center());
Q_UNUSED(widget);
Q_UNUSED(option);
}
int Piranha::type() const {
return Type;
}