author | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-06-07 18:53:14 (UTC) |
commit | 640d964cfdc7467f6cacb513087cd3acda2c04f0 (patch) (unidiff) | |
tree | 9a784686c1795f8b1f81eb344598f3b549d43467 /noncore/games/go | |
parent | dfb9c76738bb68e235114c5ad43dbd26a59b98ab (diff) | |
download | opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.zip opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.gz opie-640d964cfdc7467f6cacb513087cd3acda2c04f0.tar.bz2 |
Backing out unintentional merge from TT branch.
-rw-r--r-- | noncore/games/go/gowidget.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp index fca9797..8567b30 100644 --- a/noncore/games/go/gowidget.cpp +++ b/noncore/games/go/gowidget.cpp | |||
@@ -40,24 +40,26 @@ | |||
40 | static const enum bVal computer_color = BLACK; | 40 | static const enum bVal computer_color = BLACK; |
41 | 41 | ||
42 | static int current_handicap = 1; | 42 | static int current_handicap = 1; |
43 | 43 | ||
44 | static QBrush *goBrush; | 44 | static QBrush *goBrush; |
45 | //static QImage *newBlackStone; | 45 | //static QImage *newBlackStone; |
46 | //static QImage *blackStone; | 46 | //static QImage *blackStone; |
47 | //static QImage *whiteStone; | 47 | //static QImage *whiteStone; |
48 | static QPixmap *newBlackStone; | 48 | static QPixmap *newBlackStone; |
49 | static QPixmap *blackStone; | 49 | static QPixmap *blackStone; |
50 | static QPixmap *whiteStone; | 50 | static QPixmap *whiteStone; |
51 | 51 | ||
52 | static bool smallStones = FALSE; | ||
53 | |||
52 | GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : | 54 | GoMainWidget::GoMainWidget( QWidget *parent, const char* name) : |
53 | QMainWindow( parent, name ) | 55 | QMainWindow( parent, name ) |
54 | { | 56 | { |
55 | setToolBarsMovable( FALSE ); | 57 | setToolBarsMovable( FALSE ); |
56 | GoWidget *go = new GoWidget(this); | 58 | GoWidget *go = new GoWidget(this); |
57 | 59 | ||
58 | setCentralWidget(go); | 60 | setCentralWidget(go); |
59 | toolbar = new QPEToolBar(this); | 61 | toolbar = new QPEToolBar(this); |
60 | toolbar->setHorizontalStretchable( TRUE ); | 62 | toolbar->setHorizontalStretchable( TRUE ); |
61 | addToolBar(toolbar); | 63 | addToolBar(toolbar); |
62 | 64 | ||
63 | QPEMenuBar *mb = new QPEMenuBar( toolbar ); | 65 | QPEMenuBar *mb = new QPEMenuBar( toolbar ); |
@@ -188,24 +190,37 @@ void GoWidget::readConfig() | |||
188 | blackPrisoners = cfg.readNumEntry("BlackPrisoners",0); | 190 | blackPrisoners = cfg.readNumEntry("BlackPrisoners",0); |
189 | whitePrisoners = cfg.readNumEntry("WhitePrisoners",0); | 191 | whitePrisoners = cfg.readNumEntry("WhitePrisoners",0); |
190 | reportPrisoners(blackPrisoners,whitePrisoners); | 192 | reportPrisoners(blackPrisoners,whitePrisoners); |
191 | emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone ); | 193 | emit showTurn( currentPlayer == WHITE ? *whiteStone : *blackStone ); |
192 | } | 194 | } |
193 | 195 | ||
194 | void GoWidget::resizeEvent( QResizeEvent * ) | 196 | void GoWidget::resizeEvent( QResizeEvent * ) |
195 | { | 197 | { |
196 | d = QMIN(width(),height())/19; | 198 | d = QMIN(width(),height())/19; |
197 | // int r = (d/2-1); | 199 | // int r = (d/2-1); |
198 | bx = (width() - 18*d)/2 ; | 200 | bx = (width() - 18*d)/2 ; |
199 | by = (height() - 18*d)/2 ; | 201 | by = (height() - 18*d)/2 ; |
202 | |||
203 | if ( d < 10 && !smallStones ) { | ||
204 | blackStone->convertFromImage( blackStone->convertToImage().smoothScale(8,8) ); | ||
205 | whiteStone->convertFromImage( whiteStone->convertToImage().smoothScale(8,8) ); | ||
206 | newBlackStone->convertFromImage( newBlackStone->convertToImage().smoothScale(8,8) ); | ||
207 | |||
208 | smallStones = TRUE; | ||
209 | } else if ( d >= 10 && smallStones ) { | ||
210 | blackStone = new QPixmap(Resource::loadPixmap( "Go-black" )); | ||
211 | whiteStone = new QPixmap(Resource::loadPixmap( "Go-white" )); | ||
212 | newBlackStone = new QPixmap(Resource::loadPixmap( "Go-black-highlight" )); | ||
213 | smallStones = FALSE; | ||
214 | } | ||
200 | } | 215 | } |
201 | 216 | ||
202 | void GoWidget::init() | 217 | void GoWidget::init() |
203 | { | 218 | { |
204 | lastX = lastY = newX = newY = -1; | 219 | lastX = lastY = newX = newY = -1; |
205 | nPassed = 0; | 220 | nPassed = 0; |
206 | for ( int i = 0; i < 19; i++ ) | 221 | for ( int i = 0; i < 19; i++ ) |
207 | for ( int j = 0; j < 19; j++ ) | 222 | for ( int j = 0; j < 19; j++ ) |
208 | board[i][j]=-1; | 223 | board[i][j]=-1; |
209 | gameActive = TRUE; | 224 | gameActive = TRUE; |
210 | goRestart(current_handicap); | 225 | goRestart(current_handicap); |
211 | 226 | ||