summaryrefslogtreecommitdiff
authorcniehaus <cniehaus>2003-08-13 18:14:00 (UTC)
committer cniehaus <cniehaus>2003-08-13 18:14:00 (UTC)
commit7812d22080064f97d964dcbc3b085fde586a97d7 (patch) (unidiff)
treec7f7af3163c2c945e78a9bc91c6d8b8714a7f2e1
parent7bb7c8f7f2af7854e3d50f07a8ff33ee3462c194 (diff)
downloadopie-7812d22080064f97d964dcbc3b085fde586a97d7.zip
opie-7812d22080064f97d964dcbc3b085fde586a97d7.tar.gz
opie-7812d22080064f97d964dcbc3b085fde586a97d7.tar.bz2
more done, much more to do
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp49
-rw-r--r--noncore/games/oyatzee/oyatzee.h8
2 files changed, 43 insertions, 14 deletions
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index 6228a8f..d0e220c 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -34,34 +34,34 @@
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 40
41 setPlayerNumber( 4 ); 41 setPlayerNumber( 4 );
42 setRoundsNumber( 1 ); 42 setRoundsNumber( 1 );
43 43
44 playerList ps; 44 playerList ps;
45 ps.append( new Player( "Carsten" ) ); 45 ps.append( new Player( "Carsten" ) );
46 ps.append( new Player( "Julia" ) ); 46 ps.append( new Player( "Julia" ) );
47 ps.append( new Player( "Christine" ) ); 47 ps.append( new Player( "Christine" ) );
48 ps.append( new Player( "Stephan" ) ); 48 ps.append( new Player( "Stephan" ) );
49 49
50 Game *g = new Game( ps ); 50 //X Game *g = new Game( ps );
51 51 //X
52 52
53 QVBoxLayout *vbox = new QVBoxLayout( thing ); 53 QVBoxLayout *vbox = new QVBoxLayout( thing );
54 54
55 sb = new Scoreboard( ps, thing , "sb" ); 55 sb = new Scoreboard( ps, thing , "sb" );
56 dw = new DiceWidget( thing , "dw" ); 56 dw = new DiceWidget( thing , "dw" );
57 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); 57 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
58 58
59 vbox->addWidget( sb ); 59 vbox->addWidget( sb );
60 vbox->addWidget( dw ); 60 vbox->addWidget( dw );
61} 61}
62 62
63OYatzee::~OYatzee() 63OYatzee::~OYatzee()
64{ 64{
65} 65}
66 66
67void OYatzee::detectPosibilities() 67void OYatzee::detectPosibilities()
@@ -391,67 +391,94 @@ DiceWidget::DiceWidget( QWidget *parent , const char *name ) : QWidget( parent
391/* 391/*
392 * Player 392 * Player
393 */ 393 */
394Player::Player( QString name ) 394Player::Player( QString name )
395{ 395{
396 playerName = name; 396 playerName = name;
397} 397}
398 398
399 399
400/* 400/*
401 * Board 401 * Board
402 */ 402 */
403Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name ) 403Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name )
404{ 404{
405} 405}
406 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/* 407/*
416 * Resultboard 408 * Resultboard
417 */ 409 */
418 410
419Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) 411Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name )
420{ 412{
421 pName = playerName; 413 pName = playerName;
422} 414}
423 415
424void Resultboard::paintEvent( QPaintEvent* ) 416void Resultboard::paintEvent( QPaintEvent* )
425{ 417{
426 QPainter p; 418 QPainter p;
427 p.begin( this ); 419 p.begin( this );
428 420
429 p.drawText( 10,10, pName ); 421 p.drawText( 10,10, pName );
430 p.drawRect( 0,0, this->width() , this->height() ); 422 p.drawRect( 0,0, this->width() , this->height() );
431} 423}
432 424
433/* 425/*
434 * Possibilityboard 426 * Possibilityboard
435 */ 427 */
436 428
437Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name ) 429Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name )
438{ 430{
439} 431}
440 432
441void Possibilityboard::paintEvent( QPaintEvent* ) 433void Possibilityboard::paintEvent( QPaintEvent* )
442{ 434{
443 QPainter p; 435 QPainter p;
444 p.begin( this ); 436 p.begin( this );
445 437
446 p.drawRect( 0,0, this->width() , this->height() ); 438 const int cell_width = this->width();
439 const int h = this->height();
440 const int cell_height = h/17;
441
442 QStringList begriffe;
443 begriffe.append( "1er" );
444 begriffe.append( "2er" );
445 begriffe.append( "3er" );
446 begriffe.append( "4er" );
447 begriffe.append( "5er" );
448 begriffe.append( "6er" );
449 begriffe.append( "Total" );
450 begriffe.append( "Bonus" );
451 begriffe.append( "3oaK" );
452 begriffe.append( "4oaK" );
453 begriffe.append( "Full House" );
454 begriffe.append( "Short S" );
455 begriffe.append( "Long S" );
456 begriffe.append( "Yatzee!" );
457 begriffe.append( "Chance" );
458 begriffe.append( "Score" );
459
460 QStringList::Iterator it = begriffe.begin();
461
462 for ( int i = 1 ; i < 18 ; ++i )
463 {
464 p.drawRect( 0 , i*cell_height , cell_width , cell_height );
465 p.drawText( 0 , i*cell_height , cell_width , cell_height , Qt::AlignCenter , *it );
466 ++it;
467 }
447} 468}
448 469
449/* 470/*
450 * Game 471 * Game
451 */ 472 */
452 473
453Game::Game( playerList pla ) 474Game::Game( playerList pla )
454{ 475{
455 players = pla; 476 players = pla;
456} 477}
457 478
479void Game::startGame()
480{}
481
482void Game::stopGame()
483{}
484
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h
index dd996ee..1074f1d 100644
--- a/noncore/games/oyatzee/oyatzee.h
+++ b/noncore/games/oyatzee/oyatzee.h
@@ -94,35 +94,32 @@ class DiceWidget : public QWidget
94{ 94{
95 Q_OBJECT 95 Q_OBJECT
96 public: 96 public:
97 DiceWidget( QWidget *parent = 0, const char* name = 0 ); 97 DiceWidget( QWidget *parent = 0, const char* name = 0 );
98 98
99 QPushButton *rollButton; 99 QPushButton *rollButton;
100 100
101 dicesList diceList; 101 dicesList diceList;
102}; 102};
103 103
104 104
105class Board : public QWidget 105class Board : public QWidget
106{ 106{
107 Q_OBJECT 107 Q_OBJECT
108 public: 108 public:
109 Board( QWidget *parent = 0, const char* name = 0 ); 109 Board( QWidget *parent = 0, const char* name = 0 );
110
111 protected:
112 virtual void paintEvent( QPaintEvent *e );
113}; 110};
114 111
115class Possibilityboard : public Board 112class Possibilityboard : public Board
116{ 113{
117 Q_OBJECT 114 Q_OBJECT
118 115
119 public: 116 public:
120 Possibilityboard( QWidget *parent = 0, const char* name = 0 ); 117 Possibilityboard( QWidget *parent = 0, const char* name = 0 );
121 118
122 protected: 119 protected:
123 virtual void paintEvent( QPaintEvent *e ); 120 virtual void paintEvent( QPaintEvent *e );
124}; 121};
125 122
126class Resultboard : public Board 123class Resultboard : public Board
127{ 124{
128 Q_OBJECT 125 Q_OBJECT
@@ -153,20 +150,25 @@ class Scoreboard : public QWidget
153}; 150};
154 151
155 152
156class Player 153class Player
157{ 154{
158 public: 155 public:
159 Player( QString name ); 156 Player( QString name );
160 157
161 QString playerName; 158 QString playerName;
162 int totalPoints; 159 int totalPoints;
163}; 160};
164 161
165class Game 162class Game
166{ 163{
167 public: 164 public:
168 Game( playerList pla ); 165 Game( playerList pla );
166
169 playerList players; 167 playerList players;
168 int currentPlayer;
169
170 void startGame();
171 void stopGame();
170}; 172};
171 173
172#endif // WORDGAME_H 174#endif // WORDGAME_H