author | harlekin <harlekin> | 2003-03-24 18:09:38 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-24 18:09:38 (UTC) |
commit | c23656023651523d37406b43fd031ace4e2de89f (patch) (side-by-side diff) | |
tree | fd57e9985256064e57c3f93722ba8282f7e3be41 | |
parent | 58f8a4fe595182abb4372ab4f990e39cf67ef08a (diff) | |
download | opie-c23656023651523d37406b43fd031ace4e2de89f.zip opie-c23656023651523d37406b43fd031ace4e2de89f.tar.gz opie-c23656023651523d37406b43fd031ace4e2de89f.tar.bz2 |
pine icon now in go dir
-rw-r--r-- | noncore/games/go/gowidget.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp index 8567b30..1d38c9f 100644 --- a/noncore/games/go/gowidget.cpp +++ b/noncore/games/go/gowidget.cpp @@ -34,193 +34,193 @@ //#include <stdio.h> #include "amigo.h" #include "goplayutils.h" static const enum bVal computer_color = BLACK; static int current_handicap = 1; static QBrush *goBrush; //static QImage *newBlackStone; //static QImage *blackStone; //static QImage *whiteStone; static QPixmap *newBlackStone; static QPixmap *blackStone; static QPixmap *whiteStone; static bool smallStones = FALSE; GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : QMainWindow( parent, name ) { setToolBarsMovable( FALSE ); GoWidget *go = new GoWidget(this); setCentralWidget(go); toolbar = new QPEToolBar(this); toolbar->setHorizontalStretchable( TRUE ); addToolBar(toolbar); QPEMenuBar *mb = new QPEMenuBar( toolbar ); mb->setMargin(0); QPopupMenu *file = new QPopupMenu( this ); QAction *a = new QAction( tr( "New Game" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), go, SLOT( newGame() ) ); a->addTo( file ); a = new QAction( tr( "Pass" ), Resource::loadPixmap( "pass" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), go, SLOT( pass() ) ); a->addTo( file ); a->addTo( toolbar ); a = new QAction( tr( "Resign" ), Resource::loadPixmap( "reset" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), go, SLOT( resign() ) ); a->addTo( file ); a = new QAction( tr( "Two player option" ), QString::null, 0, this, 0 ); a->setToggleAction( TRUE ); connect( a, SIGNAL( toggled(bool) ), go, SLOT( setTwoplayer(bool) ) ); a->addTo( file ); mb->insertItem( tr( "Game" ), file ); QLabel *turnLabel = new QLabel( toolbar ); turnLabel->setBackgroundMode( PaletteButton ); connect( go, SIGNAL(showTurn(const QPixmap&)), turnLabel, SLOT(setPixmap(const QPixmap&)) ); QLabel * scoreLabel = new QLabel( toolbar ); scoreLabel->setBackgroundMode( PaletteButton ); connect( go, SIGNAL(showScore(const QString&)), scoreLabel, SLOT(setText(const QString&)) ); toolbar->setStretchableWidget( scoreLabel ); go->readConfig(); } void GoMainWidget::resizeEvent( QResizeEvent * ) { //### this won't work because of the text label... /* if ( width() > height() ) moveToolBar( toolbar, Left ); else moveToolBar( toolbar, Top ); */ } GoWidget *GoWidget::self = 0; GoWidget::GoWidget( QWidget *parent, const char* name) : QWidget( parent, name ) { if ( self ) fatal( "Only one Go widget allowed" ); self = this; twoplayer = FALSE; d = bx = by = 1; - QPixmap pix = Resource::loadPixmap( "pine" ); + QPixmap pix = Resource::loadPixmap( "go/pine" ); goBrush = new QBrush( black, pix ); /* QString fn = Resource::findPixmap("Go-black"); blackStone = new QImage( fn ); fn = Resource::findPixmap("Go-black-highlight"); newBlackStone = new QImage( fn ); fn = Resource::findPixmap("Go-white"); whiteStone = new QImage( fn ); */ blackStone = new QPixmap(Resource::loadPixmap( "Go-black" )); whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" )); newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" )); init(); } GoWidget::~GoWidget() { writeConfig(); } void GoWidget::writeConfig() { Config cfg("Go"); cfg.setGroup("Game"); cfg.writeEntry("TwoPlayer", twoplayer); cfg.writeEntry("CurrentPlayer", currentPlayer); cfg.writeEntry("NPassed", nPassed); QString b; for (int i=0; i<19; i++) for (int j=0; j<19; j++) b += board[i][j] == BLACK ? 'B' : board[i][j] == WHITE ? 'W' : '.'; cfg.writeEntry("Board", b); cfg.writeEntry("LastX", lastX); cfg.writeEntry("LastY", lastY); extern int blackPrisoners, whitePrisoners; cfg.writeEntry("BlackPrisoners", blackPrisoners); cfg.writeEntry("WhitePrisoners", whitePrisoners); } void GoWidget::readConfig() { init(); Config cfg("Go"); cfg.setGroup("Game"); twoplayer = cfg.readBoolEntry("TwoPlayer"); currentPlayer = (bVal)cfg.readNumEntry("CurrentPlayer",1); nPassed = cfg.readNumEntry("NPassed",0); QString b = cfg.readEntry("Board"); if ( b.length() == 19*19 ) for (int i=0; i<19; i++) for (int j=0; j<19; j++) { QChar ch = b[j+19*i]; if ( ch != '.' ) GoPlaceStone( ch == 'B' ? BLACK : WHITE, i, j ); } lastX = cfg.readNumEntry("LastX"); lastY = cfg.readNumEntry("LastY"); extern int blackPrisoners, whitePrisoners; blackPrisoners = cfg.readNumEntry("BlackPrisoners",0); whitePrisoners = cfg.readNumEntry("WhitePrisoners",0); reportPrisoners(blackPrisoners,whitePrisoners); emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone ); } void GoWidget::resizeEvent( QResizeEvent * ) { d = QMIN(width(),height())/19; // int r = (d/2-1); bx = (width() - 18*d)/2 ; by = (height() - 18*d)/2 ; if ( d < 10 && !smallStones ) { blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) ); whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) ); newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) ); smallStones = TRUE; } else if ( d >= 10 && smallStones ) { blackStone = new QPixmap(Resource::loadPixmap( "Go-black" )); whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" )); newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" )); smallStones = FALSE; } } void GoWidget::init() { lastX = lastY = newX = newY = -1; nPassed = 0; for ( int i = 0; i < 19; i++ ) for ( int j = 0; j < 19; j++ ) board[i][j]=-1; gameActive = TRUE; goRestart(current_handicap); |