00001 #ifndef PIXMAP_SPRITE_H
00002 #define PIXMAP_SPRITE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <QPointF>
00025 #include <QSizeF>
00026 #include <QGraphicsPixmapItem>
00027
00028
00029 #include "thememanager.h"
00030
00031
00035 class PixmapSprite : public QGraphicsPixmapItem, public virtual Themable
00036 {
00037
00038 public:
00044 PixmapSprite(int advancePeriod, int no, QGraphicsScene* scene);
00045
00053 PixmapSprite(QString id, ThemeManager* theme, int advancePeriod, int no, QGraphicsScene* scene);
00054
00057 enum AnimationState {Idle, Animated};
00058
00062 virtual void advance(int phase);
00063
00067 virtual int type() const {return QGraphicsItem::UserType+3;}
00068
00072 int number() {return mNo;}
00073
00078 virtual void changeTheme();
00079
00086 void setFrame(int no, bool force=false);
00087
00095 void setAnimation(int start, int end, int delay);
00096
00100 void setAnimation(bool status);
00101
00107 void setPosition(QPointF pos);
00108
00115 double getDoubleValue(QString item);
00116
00117 protected:
00118
00121 int mNo;
00122
00125 int mAdvancePeriod;
00126
00129 QString mId;
00130
00133 AnimationState mAnimationState;
00134
00137 QPointF mStart;
00138
00141 int mStartFrame;
00142
00145 int mEndFrame;
00146
00149 int mDelay;
00150
00153 int mTime;
00154
00157 int mCurrentFrame;
00158
00161 QList<QPixmap> mFrames;
00162
00165 QList<QPointF> mHotspots;
00166 };
00167
00168 #endif