summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2003-08-13 14:53:18 (UTC)
committer cniehaus <cniehaus>2003-08-13 14:53:18 (UTC)
commit1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a (patch) (unidiff)
tree327c797146d1a23cce2fdf558faa9ccacb9b6cf3
parent6e7dbb9320256c326cd19e7555b4309e71d039e3 (diff)
downloadopie-1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a.zip
opie-1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a.tar.gz
opie-1b22b22d6e50b46f3ea04b5a1cfc3dc9bfd8a78a.tar.bz2
well, a lot more is now implemented
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp112
-rw-r--r--noncore/games/oyatzee/oyatzee.h58
2 files changed, 160 insertions, 10 deletions
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index 5c4d1f7..6228a8f 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -1,99 +1,108 @@
1#include "oyatzee.h" 1#include "oyatzee.h"
2 2
3#include <qpe/applnk.h> 3#include <qpe/applnk.h>
4#include <qpe/global.h> 4#include <qpe/global.h>
5#include <qpe/filemanager.h> 5#include <qpe/filemanager.h>
6#include <qpe/resource.h> 6#include <qpe/resource.h>
7#include <qpe/config.h> 7#include <qpe/config.h>
8 8
9#include <qapplication.h> 9#include <qapplication.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <qcombobox.h> 11#include <qcombobox.h>
12#include <qdatetime.h> 12#include <qdatetime.h>
13#include <qfileinfo.h> 13#include <qfileinfo.h>
14#include <qfile.h> 14#include <qfile.h>
15#include <qdir.h> 15#include <qdir.h>
16#include <qiconset.h> 16#include <qiconset.h>
17#include <qlabel.h> 17#include <qlabel.h>
18#include <qlineedit.h> 18#include <qlineedit.h>
19#include <qpushbutton.h> 19#include <qpushbutton.h>
20#include <qtextstream.h> 20#include <qtextstream.h>
21#include <qtimer.h> 21#include <qtimer.h>
22#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
23#include <qtoolbutton.h> 23#include <qtoolbutton.h>
24#include <qvbox.h> 24#include <qvbox.h>
25#include <qwidgetstack.h> 25#include <qwidgetstack.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qregexp.h> 28#include <qregexp.h>
29 29
30#include <stdlib.h> 30#include <stdlib.h>
31#include <unistd.h> 31#include <unistd.h>
32#include <pwd.h> 32#include <pwd.h>
33#include <sys/types.h> 33#include <sys/types.h>
34 34
35OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) 35OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl )
36{ 36{
37 QWidget *thing = new QWidget( this ); 37 QWidget *thing = new QWidget( this );
38 setCentralWidget( thing ); 38 setCentralWidget( thing );
39 39
40
41 setPlayerNumber( 4 );
42 setRoundsNumber( 1 );
43
44 playerList ps;
45 ps.append( new Player( "Carsten" ) );
46 ps.append( new Player( "Julia" ) );
47 ps.append( new Player( "Christine" ) );
48 ps.append( new Player( "Stephan" ) );
49
50 Game *g = new Game( ps );
51
52
40 QVBoxLayout *vbox = new QVBoxLayout( thing ); 53 QVBoxLayout *vbox = new QVBoxLayout( thing );
41 54
42 sb = new Scoreboard( thing , "sb" ); 55 sb = new Scoreboard( ps, thing , "sb" );
43 dw = new DiceWidget( thing , "dw" ); 56 dw = new DiceWidget( thing , "dw" );
57 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
44 58
45 vbox->addWidget( sb ); 59 vbox->addWidget( sb );
46 vbox->addWidget( dw ); 60 vbox->addWidget( dw );
47
48 setPlayerNumber( 2 );
49 setRoundsNumber( 1 );
50
51 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
52} 61}
53 62
54OYatzee::~OYatzee() 63OYatzee::~OYatzee()
55{ 64{
56} 65}
57 66
58void OYatzee::detectPosibilities() 67void OYatzee::detectPosibilities()
59{ 68{
60 posibilities.clear(); 69 posibilities.clear();
61 qDebug( "running detectPosibilities()" ); 70 qDebug( "running detectPosibilities()" );
62 71
63 Dice *d = dw->diceList.first(); 72 Dice *d = dw->diceList.first();
64 73
65 QValueListInt numbers; 74 QValueListInt numbers;
66 75
67 for ( ; d != 0 ; d = dw->diceList.next() ) 76 for ( ; d != 0 ; d = dw->diceList.next() )
68 { 77 {
69 numbers.append( d->Value ); 78 numbers.append( d->Value );
70 } 79 }
71 80
72 //the 6 numbers 81 //the 6 numbers
73 QValueListInt::Iterator it; 82 QValueListInt::Iterator it;
74 83
75 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 84 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6
76 { 85 {
77 bool cont = false; 86 bool cont = false;
78 it = numbers.begin(); 87 it = numbers.begin();
79 for ( ; it != numbers.end() ; ++it ) 88 for ( ; it != numbers.end() ; ++it )
80 { 89 {
81 if ( cont ) 90 if ( cont )
82 continue; 91 continue;
83 92
84 if ( numbers.find( i ) != numbers.end() ) 93 if ( numbers.find( i ) != numbers.end() )
85 { 94 {
86 posibilities.append( i ); 95 posibilities.append( i );
87 cont = true; 96 cont = true;
88 } 97 }
89 } 98 }
90 } 99 }
91 100
92 101
93 //3er, 4er, Yatzee 102 //3er, 4er, Yatzee
94 it = numbers.begin(); 103 it = numbers.begin();
95 int count; 104 int count;
96 int temp; 105 int temp;
97 int countFH = 0; //for the full-house-check 106 int countFH = 0; //for the full-house-check
98 107
99 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 at least 3 times 108 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 at least 3 times
@@ -115,178 +124,204 @@ void OYatzee::detectPosibilities()
115 if ( count >= 3 ) 124 if ( count >= 3 )
116 { 125 {
117 posibilities.append( 7 ); 126 posibilities.append( 7 );
118 127
119 //now we check if it is a full house 128 //now we check if it is a full house
120 if ( count == 3 && countFH == 2 ) //aka Full House 129 if ( count == 3 && countFH == 2 ) //aka Full House
121 posibilities.append( 9 ); 130 posibilities.append( 9 );
122 } 131 }
123 if ( count >= 4 ) 132 if ( count >= 4 )
124 posibilities.append( 8 ); 133 posibilities.append( 8 );
125 if ( count == 5 ) //Yatzee 134 if ( count == 5 ) //Yatzee
126 posibilities.append( 12 ); 135 posibilities.append( 12 );
127 } 136 }
128 137
129 //S-Straight 138 //S-Straight
130 if ( numbers.find( 3 ) != numbers.end() && numbers.find( 4 ) != numbers.end() ) 139 if ( numbers.find( 3 ) != numbers.end() && numbers.find( 4 ) != numbers.end() )
131 { 140 {
132 bool isLong = false; 141 bool isLong = false;
133 bool isShort = true; 142 bool isShort = true;
134 //L-Straight 143 //L-Straight
135 if ( numbers.find( 2 ) != numbers.end() && numbers.find( 5 ) != numbers.end() ) 144 if ( numbers.find( 2 ) != numbers.end() && numbers.find( 5 ) != numbers.end() )
136 { 145 {
137 isShort = true; 146 isShort = true;
138 147
139 //12345 or 23456 148 //12345 or 23456
140 if ( numbers.find( 1 ) != numbers.end() || numbers.find( 6) != numbers.end() ) 149 if ( numbers.find( 1 ) != numbers.end() || numbers.find( 6) != numbers.end() )
141 isLong = true; 150 isLong = true;
142 } 151 }
143 //1234 152 //1234
144 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() ) 153 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() )
145 isShort = true; 154 isShort = true;
146 //3456 155 //3456
147 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() ) 156 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() )
148 isShort = true; 157 isShort = true;
149 158
150 if ( isShort ) 159 if ( isShort )
151 posibilities.append( 10 ); 160 posibilities.append( 10 );
152 if ( isLong ) 161 if ( isLong )
153 posibilities.append( 11 ); 162 posibilities.append( 11 );
154 } 163 }
155 164
156 posibilities.append( 13 ); //Chance, well, this is allways possible 165 posibilities.append( 13 ); //Chance, well, this is allways possible
157 166
158 displayPossibilites(); 167 displayPossibilites();
159} 168}
160 169
161void OYatzee::displayPossibilites() 170void OYatzee::displayPossibilites()
162{ 171{
163 qDebug( "running displayPossibilites(), %d item", posibilities.count() );
164
165 for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it ) 172 for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it )
166 { 173 {
167 qDebug( QString::number( *it ) ); 174 qDebug( QString::number( *it ) );
168 switch ( *it ) 175 switch ( *it )
169 { 176 {
170 case Ones: 177 case Ones:
171 qDebug( "1er" ); 178 qDebug( "1er" );
172 break; 179 break;
173 case Twos: 180 case Twos:
174 qDebug( "2er" ); 181 qDebug( "2er" );
175 break; 182 break;
176 case Threes: 183 case Threes:
177 qDebug( "3er" ); 184 qDebug( "3er" );
178 break; 185 break;
179 case Fours: 186 case Fours:
180 qDebug( "4er" ); 187 qDebug( "4er" );
181 break; 188 break;
182 case Fives: 189 case Fives:
183 qDebug( "5er" ); 190 qDebug( "5er" );
184 break; 191 break;
185 case Sixes: 192 case Sixes:
186 qDebug( "6er" ); 193 qDebug( "6er" );
187 break; 194 break;
188 case ThreeOfAKind: 195 case ThreeOfAKind:
189 qDebug( "3oaK" ); 196 qDebug( "3oaK" );
190 break; 197 break;
191 case FourOfAKind: 198 case FourOfAKind:
192 qDebug( "4oaK" ); 199 qDebug( "4oaK" );
193 break; 200 break;
194 case FullHouse: 201 case FullHouse:
195 qDebug( "Full House" ); 202 qDebug( "Full House" );
196 break; 203 break;
197 case SStraight: 204 case SStraight:
198 qDebug( "Short S" ); 205 qDebug( "Short S" );
199 break; 206 break;
200 case LStraight: 207 case LStraight:
201 qDebug( "Long S" ); 208 qDebug( "Long S" );
202 break; 209 break;
203 case Yatzee: 210 case Yatzee:
204 qDebug( "Yatzee!" ); 211 qDebug( "Yatzee!" );
205 break; 212 break;
206 case Chance: 213 case Chance:
207 qDebug( "Chance" ); 214 qDebug( "Chance" );
208 break; 215 break;
209 } 216 }
210 } 217 }
211} 218}
212 219
213void OYatzee::setPlayerNumber( const int num ) 220void OYatzee::setPlayerNumber( const int num )
214{ 221{
215 numOfPlayers = num; 222 numOfPlayers = num;
216} 223}
217 224
218void OYatzee::setRoundsNumber( const int num ) 225void OYatzee::setRoundsNumber( const int num )
219{ 226{
220 numOfRounds = num; 227 numOfRounds = num;
221} 228}
222 229
223void OYatzee::slotStartGame() 230void OYatzee::slotStartGame()
224{ 231{
225} 232}
226 233
227void OYatzee::slotRollDices() 234void OYatzee::slotRollDices()
228{ 235{
229 Dice *d = dw->diceList.first(); 236 Dice *d = dw->diceList.first();
230 237
231 for ( ; d != 0 ; d = dw->diceList.next() ) 238 for ( ; d != 0 ; d = dw->diceList.next() )
232 { 239 {
233 if ( !d->isSelected ) 240 if ( !d->isSelected )
234 d->roll(); 241 d->roll();
235 } 242 }
236 243
237 detectPosibilities(); 244 detectPosibilities();
238} 245}
239 246
240/* 247/*
241 * Scoreboard 248 * Scoreboard
242 */ 249 */
243Scoreboard::Scoreboard( QWidget *parent, const char *name ) : QWidget( parent , name ) 250Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name )
251{
252 ps_ = ps;
253
254 pb = new Possibilityboard( this , "pb" );
255
256 createResultboards( 4 );
257
258 QHBoxLayout *hbox = new QHBoxLayout( this );
259
260 hbox->addWidget( pb );
261
262 hbox->addSpacing( 25 );
263
264 Resultboard *r = rbList.first();
265
266 for ( ; r != 0 ; r = rbList.next() )
267 {
268 hbox->addWidget( r );
269 }
270}
271
272void Scoreboard::createResultboards(const int num)
244{ 273{
274 Player *p = ps_.first();
275 for ( int i = 0 ; i < num ; ++i , p = ps_.next() )
276 {
277 QString n = p->playerName;
278 rbList.append( new Resultboard( n , this ) );
279 }
245} 280}
246 281
247void Scoreboard::paintEvent( QPaintEvent * ) 282void Scoreboard::paintEvent( QPaintEvent * )
248{ 283{
249 QPainter p; 284 QPainter p;
250 p.begin( this ); 285 p.begin( this );
251 286
252 p.drawRect( 0,0, this->width() , this->height() ); 287 p.drawRect( 0,0, this->width() , this->height() );
253} 288}
254 289
255/* 290/*
256 * Dice 291 * Dice
257 */ 292 */
258Dice::Dice( QWidget *parent , const char *name ) : QFrame( parent , name ) 293Dice::Dice( QWidget *parent , const char *name ) : QFrame( parent , name )
259{ 294{
260 QTime t = QTime::currentTime(); // set random seed 295 QTime t = QTime::currentTime(); // set random seed
261 srand(t.hour()*12+t.minute()*60+t.second()*60); 296 srand(t.hour()*12+t.minute()*60+t.second()*60);
262 297
263 connect( this , SIGNAL( selected() ), this , SLOT( slotSelected() ) ); 298 connect( this , SIGNAL( selected() ), this , SLOT( slotSelected() ) );
264} 299}
265 300
266void Dice::slotSelected() 301void Dice::slotSelected()
267{ 302{
268 if ( isSelected ) 303 if ( isSelected )
269 isSelected = false; 304 isSelected = false;
270 else isSelected = true; 305 else isSelected = true;
271 306
272 update(); 307 update();
273} 308}
274 309
275int Dice::hasValue() 310int Dice::hasValue()
276{ 311{
277 return Value; 312 return Value;
278} 313}
279 314
280void Dice::roll() 315void Dice::roll()
281{ 316{
282 Value = rand()%6; 317 Value = rand()%6;
283 Value += 1; 318 Value += 1;
284 319
285 update(); 320 update();
286} 321}
287 322
288void Dice::mousePressEvent( QMouseEvent* /*e*/ ) 323void Dice::mousePressEvent( QMouseEvent* /*e*/ )
289{ 324{
290 emit selected(); 325 emit selected();
291} 326}
292 327
@@ -316,48 +351,107 @@ void Dice::paintNumber( QPainter *p )
316 case 3: 351 case 3:
317 p->drawText( 10,10,"3"); 352 p->drawText( 10,10,"3");
318 break; 353 break;
319 case 4: 354 case 4:
320 p->drawText( 10,10,"4"); 355 p->drawText( 10,10,"4");
321 break; 356 break;
322 case 5: 357 case 5:
323 p->drawText( 10,10,"5"); 358 p->drawText( 10,10,"5");
324 break; 359 break;
325 case 6: 360 case 6:
326 p->drawText( 10,10,"6"); 361 p->drawText( 10,10,"6");
327 break; 362 break;
328 } 363 }
329} 364}
330 365
331/* 366/*
332 * DiceWidget 367 * DiceWidget
333 */ 368 */
334DiceWidget::DiceWidget( QWidget *parent , const char *name ) : QWidget( parent , name ) 369DiceWidget::DiceWidget( QWidget *parent , const char *name ) : QWidget( parent , name )
335{ 370{
336 rollButton = new QPushButton( tr( "Roll" ) , this ) ; 371 rollButton = new QPushButton( tr( "Roll" ) , this ) ;
337 372
338 for ( int i = 0 ; i < 5 ; i++ ) 373 for ( int i = 0 ; i < 5 ; i++ )
339 { 374 {
340 //appending the 5 dices of the game 375 //appending the 5 dices of the game
341 diceList.append( new Dice( this, "wuerfel" ) ); 376 diceList.append( new Dice( this, "wuerfel" ) );
342 } 377 }
343 378
344 QHBoxLayout *hbox = new QHBoxLayout( this ); 379 QHBoxLayout *hbox = new QHBoxLayout( this );
345 380
346 Dice *d = diceList.first(); 381 Dice *d = diceList.first();
347 382
348 for ( ; d != 0 ; d = diceList.next() ) 383 for ( ; d != 0 ; d = diceList.next() )
349 { 384 {
350 hbox->addWidget( d ); 385 hbox->addWidget( d );
351 } 386 }
352 387
353 hbox->addWidget( rollButton ); 388 hbox->addWidget( rollButton );
354} 389}
355 390
356/* 391/*
357 * Player 392 * Player
358 */ 393 */
359Player::Player( QString name ) 394Player::Player( QString name )
360{ 395{
361 playerName = name; 396 playerName = name;
362} 397}
363 398
399
400/*
401 * Board
402 */
403Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name )
404{
405}
406
407void Board::paintEvent( QPaintEvent* )
408{
409 QPainter p;
410 p.begin( this );
411
412 p.drawRect( 0,0, this->width() , this->height() );
413}
414
415/*
416 * Resultboard
417 */
418
419Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name )
420{
421 pName = playerName;
422}
423
424void Resultboard::paintEvent( QPaintEvent* )
425{
426 QPainter p;
427 p.begin( this );
428
429 p.drawText( 10,10, pName );
430 p.drawRect( 0,0, this->width() , this->height() );
431}
432
433/*
434 * Possibilityboard
435 */
436
437Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name )
438{
439}
440
441void Possibilityboard::paintEvent( QPaintEvent* )
442{
443 QPainter p;
444 p.begin( this );
445
446 p.drawRect( 0,0, this->width() , this->height() );
447}
448
449/*
450 * Game
451 */
452
453Game::Game( playerList pla )
454{
455 players = pla;
456}
457
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h
index 65a18fc..dd996ee 100644
--- a/noncore/games/oyatzee/oyatzee.h
+++ b/noncore/games/oyatzee/oyatzee.h
@@ -1,116 +1,172 @@
1#ifndef WORDGAME_H 1#ifndef WORDGAME_H
2#define WORDGAME_H 2#define WORDGAME_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlabel.h> 5#include <qlabel.h>
6#include <qlist.h> 6#include <qlist.h>
7 7
8#include <stdlib.h> // rand() function 8#include <stdlib.h> // rand() function
9#include <qdatetime.h> // seed for rand() 9#include <qdatetime.h> // seed for rand()
10 10
11class Dice; 11class Dice;
12class Game; 12class Game;
13class Scoreboard; 13class Scoreboard;
14class DiceWidget; 14class DiceWidget;
15class Resultboard;
16class Player;
15 17
16typedef QList<Dice> dicesList; 18typedef QList<Dice> dicesList;
19typedef QList<Resultboard> resultboardList;
17typedef QValueList<int> QValueListInt; 20typedef QValueList<int> QValueListInt;
21typedef QList<Player> playerList;
18 22
19class OYatzee : public QMainWindow { 23class OYatzee : public QMainWindow {
20 Q_OBJECT 24 Q_OBJECT
21 public: 25 public:
22 OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 26 OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
23 ~OYatzee(); 27 ~OYatzee();
24 28
25 Game *g; 29 Game *g;
26 DiceWidget *dw; 30 DiceWidget *dw;
27 Scoreboard *sb; 31 Scoreboard *sb;
28 32
29 QValueListInt posibilities; 33 QValueListInt posibilities;
30 34
31 void setPlayerNumber( const int num ); 35 void setPlayerNumber( const int num );
32 void setRoundsNumber( const int num ); 36 void setRoundsNumber( const int num );
33 37
34 enum { 38 enum {
35 Ones=1, 39 Ones=1,
36 Twos = 2, 40 Twos = 2,
37 Threes = 3, 41 Threes = 3,
38 Fours = 4, 42 Fours = 4,
39 Fives = 5, 43 Fives = 5,
40 Sixes = 6, 44 Sixes = 6,
41 ThreeOfAKind = 7, //12444 45 ThreeOfAKind = 7, //12444
42 FourOfAKind = 8, //14444 46 FourOfAKind = 8, //14444
43 FullHouse = 9, //22555 47 FullHouse = 9, //22555
44 SStraight = 10, //13456 48 SStraight = 10, //13456
45 LStraight = 11, //12345 49 LStraight = 11, //12345
46 Yatzee = 12, //55555 50 Yatzee = 12, //55555
47 Chance = 13}; 51 Chance = 13};
48 52
49 public slots: 53 public slots:
50 void slotStartGame(); 54 void slotStartGame();
51 void slotRollDices(); 55 void slotRollDices();
52 56
53 private: 57 private:
54 int numOfPlayers; 58 int numOfPlayers;
55 int numOfRounds; 59 int numOfRounds;
56 60
61 /*
62 * Check what posibilities the player currently has
63 */
57 void detectPosibilities(); 64 void detectPosibilities();
58 void displayPossibilites(); 65 void displayPossibilites();
59 66
60}; 67};
61 68
62class Dice : public QFrame 69class Dice : public QFrame
63{ 70{
64 Q_OBJECT 71 Q_OBJECT
65 public: 72 public:
66 Dice( QWidget* parent = 0, const char* name = 0 ); 73 Dice( QWidget* parent = 0, const char* name = 0 );
67 74
68 int Value; 75 int Value;
69 bool isSelected; 76 bool isSelected;
70 77
71 int hasValue(); 78 int hasValue();
72 void roll(); 79 void roll();
73 virtual void mousePressEvent( QMouseEvent* ); 80 virtual void mousePressEvent( QMouseEvent* );
74 81
75 private slots: 82 private slots:
76 void slotSelected(); 83 void slotSelected();
77 84
78 signals: 85 signals:
79 void selected(); 86 void selected();
80 87
81 protected: 88 protected:
82 void paintEvent( QPaintEvent *e ); 89 void paintEvent( QPaintEvent *e );
83 void paintNumber( QPainter *p ); 90 void paintNumber( QPainter *p );
84}; 91};
85 92
86class DiceWidget : public QWidget 93class DiceWidget : public QWidget
87{ 94{
88 Q_OBJECT 95 Q_OBJECT
89 public: 96 public:
90 DiceWidget( QWidget *parent = 0, const char* name = 0 ); 97 DiceWidget( QWidget *parent = 0, const char* name = 0 );
91 98
92 QPushButton *rollButton; 99 QPushButton *rollButton;
93 100
94 dicesList diceList; 101 dicesList diceList;
95}; 102};
96 103
104
105class Board : public QWidget
106{
107 Q_OBJECT
108 public:
109 Board( QWidget *parent = 0, const char* name = 0 );
110
111 protected:
112 virtual void paintEvent( QPaintEvent *e );
113};
114
115class Possibilityboard : public Board
116{
117 Q_OBJECT
118
119 public:
120 Possibilityboard( QWidget *parent = 0, const char* name = 0 );
121
122 protected:
123 virtual void paintEvent( QPaintEvent *e );
124};
125
126class Resultboard : public Board
127{
128 Q_OBJECT
129
130 public:
131 Resultboard( QString playerName , QWidget *parent = 0, const char* name = 0 );
132 QString pName;
133
134 protected:
135 virtual void paintEvent( QPaintEvent *e );
136};
137
138
97class Scoreboard : public QWidget 139class Scoreboard : public QWidget
98{ 140{
99 Q_OBJECT 141 Q_OBJECT
100 public: 142 public:
101 Scoreboard( QWidget *parent = 0, const char* name = 0 ); 143 Scoreboard( playerList ps, QWidget *parent = 0, const char* name = 0 );
144
145 Possibilityboard *pb;
146 resultboardList rbList;
147 playerList ps_;
102 148
149 void createResultboards(const int);
150
103 protected: 151 protected:
104 void paintEvent( QPaintEvent *e ); 152 void paintEvent( QPaintEvent *e );
105}; 153};
106 154
155
107class Player 156class Player
108{ 157{
109 public: 158 public:
110 Player( QString name ); 159 Player( QString name );
111 160
112 QString playerName; 161 QString playerName;
113 int totalPoints; 162 int totalPoints;
114}; 163};
115 164
165class Game
166{
167 public:
168 Game( playerList pla );
169 playerList players;
170};
171
116#endif // WORDGAME_H 172#endif // WORDGAME_H