forked from kn0w0n3/Super_Mario
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgiantgoomba.cpp
41 lines (30 loc) · 815 Bytes
/
giantgoomba.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
/*
* Author: equati0n
* Date: December 2016
*/
#include "giantgoomba.h"
#include <QPainter>
GiantGoomba::GiantGoomba(QGraphicsItem *parent): QGraphicsItem(parent)
,mCurrentFrame12()
{
setFlag(ItemClipsToShape);
mPixmap12 = QPixmap(":images/goomba.png");
}
void GiantGoomba::nextFrame12(){
mCurrentFrame12 += 121;
if (mCurrentFrame12 >= 1899 ) {
mCurrentFrame12 = 0;
}
}
QRectF GiantGoomba::boundingRect() const {
return QRectF(0,0,110,97);
}
void GiantGoomba::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) {
Q_UNUSED(widget);
Q_UNUSED(option);
painter->drawPixmap(0,0, mPixmap12, mCurrentFrame12, 0,110, 97);
setTransformOriginPoint(boundingRect().center());
}
int GiantGoomba::type() const {
return Type;
}