Diffstat (limited to 'noncore/games/oyatzee/oyatzee.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/oyatzee/oyatzee.cpp | 49 |
1 files changed, 38 insertions, 11 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 | |||
@@ -44,14 +44,14 @@ OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( | |||
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() ) ); |
@@ -401,20 +401,12 @@ Player::Player( QString name ) | |||
401 | * Board | 401 | * Board |
402 | */ | 402 | */ |
403 | Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name ) | 403 | Board::Board( QWidget *parent , const char* name ) : QWidget ( parent , name ) |
404 | { | 404 | { |
405 | } | 405 | } |
406 | 406 | ||
407 | void 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 | ||
419 | Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) | 411 | Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) |
420 | { | 412 | { |
@@ -440,18 +432,53 @@ Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board | |||
440 | 432 | ||
441 | void Possibilityboard::paintEvent( QPaintEvent* ) | 433 | void 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 | ||
453 | Game::Game( playerList pla ) | 474 | Game::Game( playerList pla ) |
454 | { | 475 | { |
455 | players = pla; | 476 | players = pla; |
456 | } | 477 | } |
457 | 478 | ||
479 | void Game::startGame() | ||
480 | {} | ||
481 | |||
482 | void Game::stopGame() | ||
483 | {} | ||
484 | |||