display_two.h

Go to the documentation of this file.
00001 #ifndef DISPLAY_TWO_H
00002 #define DISPLAY_TWO_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 <QGraphicsScene>
00025 #include <QPixmap>
00026 #include <QHash>
00027 
00028 // KDE includes
00029 #include <kdebug.h>
00030 
00031 // Local includes
00032 #include "abstractdisplay.h"
00033 #include "thememanager.h"
00034 #include "deck.h"
00035 #include "player.h"
00036 
00037 // Forward declaration
00038 class PixmapSprite;
00039 class ScoreSprite;
00040 class TextSprite;
00041 
00042 
00045 class DisplayTwo : public AbstractDisplay, public virtual Themable
00046 {
00047   Q_OBJECT
00048 
00049   public:
00057     DisplayTwo(Deck* deck, QGraphicsScene* scene, ThemeManager* theme, int advancePeriod,  QGraphicsView* parent);
00058 
00061     void start(); 
00062 
00066     virtual void changeTheme();
00067 
00068     /* Init a player on a given position. Create sprites etc.
00069      * @param player The player object
00070      * @param position The position to place the player (0,1)
00071      */
00072     void deal(Player* player, int position);
00073 
00080     void play(int cardNumber, int playerNumber, int phase);
00081 
00086     void turn(int cardNumber);
00087 
00093     void remove(int winnerPosition, int cardNumber, int delta);
00094   
00099     int shuffleTime();
00100 
00105     void showScore(int position, int score);
00106 
00110     void showText(QString text);
00111 
00115     void showMove(int no = -1);
00116 
00117   public slots:
00125     void convertMousePress(QPoint mouse, int& playerNumber, int& cardNumber);
00126 
00131     void updatePlayer(Player* player);
00132 
00133   protected:
00139     void calcXYFromNumber(int cardNumber, int& x, int& y);
00140 
00145     CardSprite* getCardSprite(int cardValue);
00146 
00147   private:
00148     // Pixmap for movement sprite 
00149     QPixmap* mMovePixmap;
00150     // Store all move sprites
00151     QHash<int,PixmapSprite*> mMoveSprites;
00152     // The score sprites
00153     ScoreSprite*  mScoreBoard[2];
00154     // The card area background sprites
00155     PixmapSprite* mCardArea[2];
00156     // The play area background sprite
00157     PixmapSprite* mPlayArea;
00158     // The text sprites
00159     TextSprite*   mText[3];
00160 };
00161 
00162 #endif

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