abstractengine.h

Go to the documentation of this file.
00001 #ifndef ABSTGRACT_ENGINE_H
00002 #define ABSTGRACT_ENGINE_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 <QWidget>
00025 #include <QHash>
00026 
00027 // KDE includes
00028 #include <kdebug.h>
00029 
00030 // Local includes
00031 #include "deck.h"
00032 
00033 // Forward declaration
00034 class Player;
00035 
00036 using namespace CardDeck;
00037 
00041 class AbstractEngine : public QObject
00042 {
00043   Q_OBJECT
00044 
00045   public:
00049     AbstractEngine(QWidget* parent);
00050 
00052     enum GameStatus {Running, Stopped};
00053 
00058     virtual void startGame(Suite trump, int startPlayer) = 0;
00059 
00062     virtual void stopGame() = 0;
00063 
00067      virtual bool isGameRunning() {return mGameStatus == Running;}
00068 
00073     virtual void addPlayer(int no, Player* player);
00074 
00079     virtual Player* player(int no);
00080 
00084    virtual int currentPlayer() {return mCurrentPlayer;}  
00085 
00086   public slots:
00087 
00093     virtual void playerInput(int inputId, int playerNumber, int cardNumber) = 0;
00094 
00095   signals:
00099     void signalGameOver(int winner);
00100 
00104     void signalNextPlayer(Player* player); 
00105 
00106   protected:
00108     GameStatus mGameStatus;
00110     int mCurrentPlayer;
00111 
00113     QHash<int, Player*> mPlayers;
00114     
00115 };
00116 
00117 #endif

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