piecesprite.h

Go to the documentation of this file.
00001 #ifndef PIECE_SPRITE_H
00002 #define PIECE_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 #include "spritenotify.h"
00032 
00033 
00037 class PieceSprite : public PixmapSprite
00038 {
00039 
00040   public:
00043     PieceSprite(QString id, ThemeManager* theme, int advancePeriod, int no, QGraphicsScene* canvas);
00044     
00047     ~PieceSprite();
00048 
00051     enum MovementState {Idle, LinearMove};
00052 
00056     virtual void advance(int phase);
00057 
00061     virtual int type() const {return QGraphicsItem::UserType+2;}
00062 
00066     virtual void changeTheme();
00067 
00072     SpriteNotify* notify() {return mNotify;}
00073 
00079     void startLinear(QPointF end, double velocity);
00080     
00087     void startLinear(QPointF start, QPointF end, double velocity);
00088 
00089   private:
00090 
00091     // The duration of the movement 
00092     double mDuration;
00093 
00094     // The state of the movement
00095     MovementState mMovementState;
00096 
00097     // The end points of the movement [rel]
00098     QPointF mEnd;
00099 
00100     // The movment sprite notifier
00101     SpriteNotify* mNotify;
00102 
00103 };
00104 
00105 #endif

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