-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgamesprite.h
64 lines (54 loc) · 1.4 KB
/
gamesprite.h
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef GAMESPRITE_H
#define GAMESPRITE_H
#include <QGraphicsItemGroup>
class DLAction: QObject
{
public:
DLAction(){
framesIDSet = new QList<int>();
delayTimeSet = new QList<int>();
}
~DLAction(){
delete framesIDSet;
framesIDSet = NULL;
delete delayTimeSet;
delayTimeSet = NULL;
}
QList<int> *framesIDSet;
QList<int> *delayTimeSet;
};
class GameSprite : public QGraphicsItemGroup, public QObject
{
public:
GameSprite(QString &file);
~GameSprite();
enum eModuleTypeIdx
{
MTI_IMG=0, //图
MTI_LINE, //线
MTI_RECT, //矩形
MTI_RECT_FILL,//填充矩形
MTI_TRI, //三角形
MTI_TRI_FILL, //填充三角形
MTI_ARC, //弧形
MTI_ARC_FILL, //填充弧形
MTI_R_RECT, //圆角矩形
MTI_R_RECT_FILL,//填充圆角矩形
MTI_STR //文字
};
private:
QList<QGraphicsItemGroup*> *frameList;
QList<DLAction*> *actionList;
QGraphicsItemGroup *currentFrame;
int currentActionID;
int currentActionIndex;
int currentDelayTime;
//void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
bool loadBin(QString &file);
void startAction(int actionID);
void showFrame(int frameID);
int m_nTimerId;
void timerEvent( QTimerEvent *event );
private slots:
};
#endif // GAMESPRITE_H