forked from kn0w0n3/Super_Mario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoin.cpp
44 lines (33 loc) · 771 Bytes
/
coin.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
/*
* Author: equati0n
* Date: December 2016
*/
#include "coin.h"
#include <QPainter>
#include<QList>
Coin::Coin(QGraphicsItem *parent)
: QGraphicsItem(parent)
,mCurrentFrame2()
{
setFlag(ItemClipsToShape);
mPixmap2 = QPixmap(":images/coin.png");
}
void Coin::nextFrame2(){
mCurrentFrame2 += 38;
if (mCurrentFrame2 >= 300 ) {
mCurrentFrame2 = 0;
}
}
QRectF Coin::boundingRect() const {
return QRectF(0,0,39,41);
}
void Coin::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
painter->drawPixmap(0,0, mPixmap2, mCurrentFrame2, 0,39, 41);
setTransformOriginPoint(boundingRect().center());
Q_UNUSED(widget);
Q_UNUSED(option);
}
int Coin::type() const
{
return Type;
}