kblackbox
kbbgamedoc.h
Go to the documentation of this file.00001 // 00002 // KBlackBox 00003 // 00004 // A simple game inspired by an emacs module 00005 // 00006 /*************************************************************************** 00007 * Copyright (c) 1999-2000, Robert Cimrman * 00008 * cimrman3@students.zcu.cz * 00009 * * 00010 * Copyright (c) 2007, Nicolas Roffet * 00011 * nicolas-kde@roffet.com * 00012 * * 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 * This program is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00022 * GNU General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU General Public License * 00025 * along with this program; if not, write to the * 00026 * Free Software Foundation, Inc., * 00027 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * 00028 ***************************************************************************/ 00029 00030 00031 00032 #ifndef KBBGAMEDOC_H 00033 #define KBBGAMEDOC_H 00034 00035 00036 #include <QObject> 00037 00038 00039 #include <krandomsequence.h> 00040 00041 00042 class KBBBallsOnBoard; 00043 #include "kbbmainwindow.h" 00044 class KBBTutorial; 00045 00046 00047 00056 class KBBGameDoc : public QObject 00057 { 00058 Q_OBJECT 00059 00060 public: 00065 static const int HIT_POSITION = -1; 00066 00067 static const int SCORE_LOST = 999; 00068 static const int SCORE_ONE = 3; 00069 static const int SCORE_TWO = 9; 00070 00071 00075 KBBGameDoc(KBBMainWindow *parent, KBBTutorial* tutorial); 00076 00077 00081 int columns() const; 00082 00086 void gameOver(); 00087 00094 bool gameReallyStarted(); 00095 00096 bool mayShootRay(const int incomingPosition) const; 00097 00105 void newGame(int balls, int columns, int rows); 00106 00110 int numberOfBallsPlaced(); 00111 00115 int numberOfBallsToPlace(); 00116 00120 int rows() const; 00121 00125 int score(); 00126 00136 int shootRay(int borderPosition); 00137 00141 void startTutorial(); 00142 00143 00144 KBBBallsOnBoard* m_balls; 00145 KBBBallsOnBoard* m_ballsPlaced; 00146 00147 00148 public slots: 00149 void timeChanged(); 00150 00151 00152 signals: 00153 void isRunning(bool); 00154 void updateStats(); 00155 00156 00157 private: 00158 void setRunning(bool r); 00159 00165 void setScore( int n ); 00166 00167 void clean(const int columns, const int rows); 00168 00169 int m_columns; 00170 bool m_gameReallyStarted; 00171 int m_rows; 00172 KRandomSequence m_random; 00173 int m_score; 00174 KBBTutorial* m_tutorial; 00175 }; 00176 00177 #endif //KBBGAMEDOC_H
KDE 4.2 API Reference