pixmapsprite.h

Go to the documentation of this file.
00001 #ifndef PIXMAP_SPRITE_H
00002 #define PIXMAP_SPRITE_H
00003 /*
00004    This file is part of the KDE games lskat program
00005    Copyright (c) 2006 Martin Heni <kde@heni-online.de>
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public License
00018    along with this library; see the file COPYING.LIB.  If not, write to
00019    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020    Boston, MA 02110-1301, USA.
00021 */
00022 
00023 // Qt includes
00024 #include <QPointF>
00025 #include <QSizeF>
00026 #include <QGraphicsPixmapItem>
00027 
00028 // Local includes
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

Generated on Tue May 1 09:34:40 2007 for LSkat by  doxygen 1.4.6