score.h

Go to the documentation of this file.
00001 #ifndef SCORE_H
00002 #define SCORE_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 
00024 // Qt includes
00025 #include <QObject>
00026 
00027 class ScoreSprite;
00028 
00029 
00034 class Score : public QObject
00035 { 
00036     Q_OBJECT
00037 
00038 public:
00042     Score(QObject* parent = 0);
00043     
00048     void setLevel(int level, int no) {mLevel[no] = level; update();}
00049 
00054     void setPlayerName(QString name,int no) {mName[no] = name;update();}
00055 
00059     void setTurn(int no) {mTurn = no;update();}  
00060 
00065     void setWins(int amount, int no) {mWin[no] = amount; update();}
00066 
00071     void setLosses(int amount, int no) {mLoss[no] = amount; update();}
00072 
00077     void setRemis(int amount, int no) {mRemis[no] = amount; update();}
00078 
00083     void setBreaks(int amount, int no) {mBrk[no] = amount; update();}
00084 
00089     void setPlayedBy(int type, int no) {mInputDevice[no] = type; update();}
00090 
00095     void setDisplay(ScoreSprite* s);
00096 
00097 protected:
00100     void update();
00101 
00102 private:
00103     // The display sprite
00104     ScoreSprite* mDisplay;
00105 
00106     // The name of the players
00107     QString mName[2];
00108     
00109     // The level of the AI(s)
00110     int mLevel[2];
00111     
00112     // Whose turn is it
00113     int mTurn;
00114     
00115     // The amount of wins
00116     int mWin[2];
00117     
00118     // The amount of draws
00119     int mRemis[2];
00120     
00121     // The amount of losses
00122     int mLoss[2];
00123     
00124     // The amount of aboerted games
00125     int mBrk[2];
00126     
00127     // The input device
00128     int mInputDevice[2];
00129 };
00130 
00131 #endif 
00132 

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