introsprite.h

Go to the documentation of this file.
00001 #ifndef INTRO_SPRITE_H
00002 #define INTRO_SPRITE_H
00003 /*
00004    This file is part of the KDE games kwin4 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 #include "pixmapsprite.h"
00031 
00032 
00035 class IntroSprite : public PixmapSprite
00036 {
00037 
00038   public:
00046     IntroSprite(QString id, ThemeManager* theme, int advancePeriod, int no, QGraphicsScene* scence);
00047 
00050     ~IntroSprite();
00051 
00063     void startIntro(QPointF start, QPointF end, double radius, double duration, double delay);
00064 
00070     void startLinear(QPointF start, QPointF end, double duration);
00071 
00076     void startLinear(QPointF end, double duration);
00077 
00078     // Possible animation states of the sprite
00079     enum MovementState {Idle, IntroDelay, IntroLinear1, IntroCircle, IntroLinear2, LinearMove};
00080 
00084     virtual void advance(int phase);
00085 
00089     virtual int type() const {return QGraphicsItem::UserType+1;}
00090 
00094     int number() {return mNo;}
00095 
00099     virtual void changeTheme();
00100 
00101   private:
00102 
00103     // The duration of the movement animation 
00104     double mDuration;
00105     // The current time of the movement animation [0..mDuration]
00106     double mTime;
00107     // The start delay before movement starts
00108     double mDelay;
00109 
00110     // The start points of the movement [rel]
00111     QPointF mStart;
00112     // The end points of the movement [rel]
00113     QPointF mEnd;
00114     // The radius of the circular movement [rel]
00115     double mRadius;
00116 
00117     // The state of the animation
00118     MovementState mAnimationState;
00119 
00120 };
00121 
00122 #endif

Generated on Sun Mar 4 10:56:43 2007 for KWin4 by  doxygen 1.4.6