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/solitaire | |
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/solitaire/canvascard.cpp | 71 | ||||
-rw-r--r-- | noncore/games/solitaire/canvasshapes.cpp | 52 | ||||
-rw-r--r-- | noncore/games/solitaire/freecellcardgame.cpp | 11 | ||||
-rw-r--r-- | noncore/games/solitaire/patiencecardgame.cpp | 49 | ||||
-rw-r--r-- | noncore/games/solitaire/patiencecardgame.h | 7 |
5 files changed, 137 insertions, 53 deletions
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp index ae3c859..7c4a5ba 100644 --- a/noncore/games/solitaire/canvascard.cpp +++ b/noncore/games/solitaire/canvascard.cpp | |||
@@ -29,2 +29,3 @@ | |||
29 | #include <qbitmap.h> | 29 | #include <qbitmap.h> |
30 | #include <qgfx_qws.h> // Needed to get the device's width | ||
30 | 31 | ||
@@ -104,6 +105,13 @@ CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) : | |||
104 | if ( !cardsFaces ) { | 105 | if ( !cardsFaces ) { |
105 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); | 106 | if ( qt_screen->deviceWidth() < 200 ) { |
106 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); | 107 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) ); |
107 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) ); | 108 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); |
108 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); | 109 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) ); |
110 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) ); | ||
111 | } else { | ||
112 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); | ||
113 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); | ||
114 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) ); | ||
115 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); | ||
116 | } | ||
109 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); | 117 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); |
@@ -128,13 +136,28 @@ void CanvasCard::setCardBack(int b) | |||
128 | 136 | ||
129 | switch (cardBack) { | 137 | if ( qt_screen->deviceWidth() < 200 ) { |
130 | case 0: | 138 | switch (cardBack) { |
131 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break; | 139 | case 0: |
132 | case 1: | 140 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break; |
133 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break; | 141 | case 1: |
134 | case 2: | 142 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break; |
135 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break; | 143 | case 2: |
136 | case 3: | 144 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break; |
137 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break; | 145 | case 3: |
138 | case 4: | 146 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break; |
139 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break; | 147 | case 4: |
148 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break; | ||
149 | } | ||
150 | } else { | ||
151 | switch (cardBack) { | ||
152 | case 0: | ||
153 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break; | ||
154 | case 1: | ||
155 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break; | ||
156 | case 2: | ||
157 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break; | ||
158 | case 3: | ||
159 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break; | ||
160 | case 4: | ||
161 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break; | ||
162 | } | ||
140 | } | 163 | } |
@@ -183,7 +206,15 @@ void CanvasCard::draw(QPainter &painter) | |||
183 | 206 | ||
184 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | 207 | if ( qt_screen->deviceWidth() < 200 ) { |
185 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); | 208 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); |
186 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); | 209 | p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 ); |
187 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); | 210 | p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 ); |
188 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); | 211 | p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 ); |
212 | p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 ); | ||
213 | } else { | ||
214 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | ||
215 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); | ||
216 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); | ||
217 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); | ||
218 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); | ||
219 | } | ||
189 | 220 | ||
diff --git a/noncore/games/solitaire/canvasshapes.cpp b/noncore/games/solitaire/canvasshapes.cpp index 28d0b4e..6ccd4a4 100644 --- a/noncore/games/solitaire/canvasshapes.cpp +++ b/noncore/games/solitaire/canvasshapes.cpp | |||
@@ -21,2 +21,3 @@ | |||
21 | #include <qcanvas.h> | 21 | #include <qcanvas.h> |
22 | #include <qgfx_qws.h> | ||
22 | #include "canvasshapes.h" | 23 | #include "canvasshapes.h" |
@@ -25,3 +26,3 @@ | |||
25 | CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) : | 26 | CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) : |
26 | QCanvasRectangle( x, y, 23, 36, canvas) | 27 | QCanvasRectangle( x, y, ( qt_screen->deviceWidth() < 200 ) ? 20 : 23, ( qt_screen->deviceWidth() < 200 ) ? 27 : 36, canvas) |
27 | { | 28 | { |
@@ -41,3 +42,6 @@ void CanvasRoundRect::drawShape(QPainter &p) | |||
41 | { | 42 | { |
42 | p.drawRoundRect( (int)x(), (int)y(), 23, 36); | 43 | if ( qt_screen->deviceWidth() < 200 ) |
44 | p.drawRoundRect( (int)x() + 1, (int)y() + 1, 18, 25); | ||
45 | else | ||
46 | p.drawRoundRect( (int)x(), (int)y(), 23, 36); | ||
43 | } | 47 | } |
@@ -75,16 +79,34 @@ void CanvasCircleOrCross::drawShape(QPainter &p) | |||
75 | { | 79 | { |
76 | int x1 = (int)x(), y1 = (int)y(); | 80 | if ( qt_screen->deviceWidth() < 200 ) { |
77 | // Green circle | 81 | int x1 = (int)x(), y1 = (int)y(); |
78 | if (circleShape == TRUE) { | 82 | // Green circle |
79 | p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) ); | 83 | if (circleShape == TRUE) { |
80 | p.drawEllipse( x1 - 1, y1 - 1, 21, 21); | 84 | p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) ); |
81 | p.drawEllipse( x1 - 1, y1 - 0, 21, 19); | 85 | p.drawEllipse( x1 - 1, y1 - 1, 17, 17); |
82 | p.drawEllipse( x1 + 0, y1 + 0, 19, 19); | 86 | p.drawEllipse( x1 - 1, y1 - 0, 17, 15); |
83 | p.drawEllipse( x1 + 1, y1 + 0, 17, 19); | 87 | p.drawEllipse( x1 + 0, y1 + 0, 15, 15); |
84 | p.drawEllipse( x1 + 1, y1 + 1, 17, 17); | 88 | p.drawEllipse( x1 + 1, y1 + 0, 13, 15); |
85 | // Red cross | 89 | p.drawEllipse( x1 + 1, y1 + 1, 13, 13); |
90 | // Red cross | ||
91 | } else { | ||
92 | p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 4 ) ); | ||
93 | p.drawLine( x1, y1, x1 + 14, y1 + 14); | ||
94 | p.drawLine( x1 + 14, y1, x1, y1 + 14); | ||
95 | } | ||
86 | } else { | 96 | } else { |
87 | p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 5 ) ); | 97 | int x1 = (int)x(), y1 = (int)y(); |
88 | p.drawLine( x1, y1, x1 + 20, y1 + 20); | 98 | // Green circle |
89 | p.drawLine( x1 + 20, y1, x1, y1 + 20); | 99 | if (circleShape == TRUE) { |
100 | p.setPen( QPen( QColor(0x10, 0xE0, 0x10), 1 ) ); | ||
101 | p.drawEllipse( x1 - 1, y1 - 1, 21, 21); | ||
102 | p.drawEllipse( x1 - 1, y1 - 0, 21, 19); | ||
103 | p.drawEllipse( x1 + 0, y1 + 0, 19, 19); | ||
104 | p.drawEllipse( x1 + 1, y1 + 0, 17, 19); | ||
105 | p.drawEllipse( x1 + 1, y1 + 1, 17, 17); | ||
106 | // Red cross | ||
107 | } else { | ||
108 | p.setPen( QPen( QColor(0xE0, 0x10, 0x10), 5 ) ); | ||
109 | p.drawLine( x1, y1, x1 + 20, y1 + 20); | ||
110 | p.drawLine( x1 + 20, y1, x1, y1 + 20); | ||
111 | } | ||
90 | } | 112 | } |
diff --git a/noncore/games/solitaire/freecellcardgame.cpp b/noncore/games/solitaire/freecellcardgame.cpp index e82afd4..98415aa 100644 --- a/noncore/games/solitaire/freecellcardgame.cpp +++ b/noncore/games/solitaire/freecellcardgame.cpp | |||
@@ -19,2 +19,3 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qgfx_qws.h> | ||
20 | #include "freecellcardgame.h" | 21 | #include "freecellcardgame.h" |
@@ -31,4 +32,8 @@ FreecellCardGame::FreecellCardGame(QCanvas *c, bool snap, QWidget *parent) : Can | |||
31 | 32 | ||
33 | int spaceBetweenPiles = ( qt_screen->deviceWidth() < 200 ) ? 21 : 28; | ||
34 | int xOrigin = ( qt_screen->deviceWidth() < 200 ) ? 0 : 5; | ||
35 | int spacing = ( qt_screen->deviceWidth() < 200 ) ? 0 : 0; | ||
36 | |||
32 | for (int i = 0; i < 4; i++) { | 37 | for (int i = 0; i < 4; i++) { |
33 | freecellPiles[i] = new FreecellFreecellPile( 5 + i * 28, 10, canvas() ); | 38 | freecellPiles[i] = new FreecellFreecellPile( xOrigin + i * spaceBetweenPiles, 10, canvas() ); |
34 | addCardPile(freecellPiles[i]); | 39 | addCardPile(freecellPiles[i]); |
@@ -36,3 +41,3 @@ FreecellCardGame::FreecellCardGame(QCanvas *c, bool snap, QWidget *parent) : Can | |||
36 | for (int i = 0; i < 4; i++) { | 41 | for (int i = 0; i < 4; i++) { |
37 | discardPiles[i] = new FreecellDiscardPile( 125 + i * 28, 10, canvas() ); | 42 | discardPiles[i] = new FreecellDiscardPile( xOrigin + spacing + 6 + (i + 4) * spaceBetweenPiles, 10, canvas() ); |
38 | addCardPile(discardPiles[i]); | 43 | addCardPile(discardPiles[i]); |
@@ -40,3 +45,3 @@ FreecellCardGame::FreecellCardGame(QCanvas *c, bool snap, QWidget *parent) : Can | |||
40 | for (int i = 0; i < 8; i++) { | 45 | for (int i = 0; i < 8; i++) { |
41 | workingPiles[i] = new FreecellWorkingPile( 10 + i * 28, 50, canvas() ); | 46 | workingPiles[i] = new FreecellWorkingPile( xOrigin + spacing + 2 + i * spaceBetweenPiles, 50, canvas() ); |
42 | addCardPile(workingPiles[i]); | 47 | addCardPile(workingPiles[i]); |
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp index 5a9326a..1501d2f 100644 --- a/noncore/games/solitaire/patiencecardgame.cpp +++ b/noncore/games/solitaire/patiencecardgame.cpp | |||
@@ -19,2 +19,3 @@ | |||
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qgfx_qws.h> | ||
20 | #include "patiencecardgame.h" | 21 | #include "patiencecardgame.h" |
@@ -30,15 +31,31 @@ PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : Can | |||
30 | 31 | ||
31 | circleCross = new CanvasCircleOrCross( 7, 18, canvas() ); | 32 | if ( qt_screen->deviceWidth() < 200 ) { |
32 | rectangle = new CanvasRoundRect( 35, 10, canvas() ); | 33 | circleCross = new CanvasCircleOrCross( 7, 16, canvas() ); |
34 | rectangle = new CanvasRoundRect( 30, 10, canvas() ); | ||
33 | 35 | ||
34 | for (int i = 0; i < 4; i++) { | 36 | for (int i = 0; i < 4; i++) { |
35 | discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() ); | 37 | discardPiles[i] = new PatienceDiscardPile( 78 + i * 23, 10, canvas() ); |
36 | addCardPile(discardPiles[i]); | 38 | addCardPile(discardPiles[i]); |
37 | } | 39 | } |
38 | for (int i = 0; i < 7; i++) { | 40 | for (int i = 0; i < 7; i++) { |
39 | workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() ); | 41 | workingPiles[i] = new PatienceWorkingPile( 5 + i * 23, 50, canvas() ); |
40 | addCardPile(workingPiles[i]); | 42 | addCardPile(workingPiles[i]); |
43 | } | ||
44 | faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() ); | ||
45 | faceUpDealingPile = new PatienceFaceUpDeck( 30, 10, canvas() ); | ||
46 | } else { | ||
47 | circleCross = new CanvasCircleOrCross( 7, 18, canvas() ); | ||
48 | rectangle = new CanvasRoundRect( 35, 10, canvas() ); | ||
49 | |||
50 | for (int i = 0; i < 4; i++) { | ||
51 | discardPiles[i] = new PatienceDiscardPile( 110 + i * 30, 10, canvas() ); | ||
52 | addCardPile(discardPiles[i]); | ||
53 | } | ||
54 | for (int i = 0; i < 7; i++) { | ||
55 | workingPiles[i] = new PatienceWorkingPile( 10 + i * 30, 50, canvas() ); | ||
56 | addCardPile(workingPiles[i]); | ||
57 | } | ||
58 | faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() ); | ||
59 | faceUpDealingPile = new PatienceFaceUpDeck( 35, 10, canvas() ); | ||
41 | } | 60 | } |
42 | faceDownDealingPile = new PatienceFaceDownDeck( 5, 10, canvas() ); | ||
43 | faceUpDealingPile = new PatienceFaceUpDeck( 35, 10, canvas() ); | ||
44 | } | 61 | } |
@@ -175,3 +192,6 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) | |||
175 | 192 | ||
176 | item->flipTo( 35, (int)item->y() ); | 193 | if ( qt_screen->deviceWidth() < 200 ) |
194 | item->flipTo( 30, (int)item->y() ); | ||
195 | else | ||
196 | item->flipTo( 35, (int)item->y() ); | ||
177 | } | 197 | } |
@@ -197,3 +217,6 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) | |||
197 | 217 | ||
198 | item->flipTo( 35, (int)item->y(), 8 * flipped ); | 218 | if ( qt_screen->deviceWidth() < 200 ) |
219 | item->flipTo( 30, (int)item->y(), 8 * flipped ); | ||
220 | else | ||
221 | item->flipTo( 35, (int)item->y(), 8 * flipped ); | ||
199 | } | 222 | } |
diff --git a/noncore/games/solitaire/patiencecardgame.h b/noncore/games/solitaire/patiencecardgame.h index c4f6c48..0d0e3d5 100644 --- a/noncore/games/solitaire/patiencecardgame.h +++ b/noncore/games/solitaire/patiencecardgame.h | |||
@@ -27,2 +27,3 @@ | |||
27 | #include <qcanvas.h> | 27 | #include <qcanvas.h> |
28 | #include <qgfx_qws.h> | ||
28 | // #include "canvascardshapes.h" | 29 | // #include "canvascardshapes.h" |
@@ -132,2 +133,3 @@ public: | |||
132 | if ( newTopCard->isFacing() == FALSE ) { | 133 | if ( newTopCard->isFacing() == FALSE ) { |
134 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | ||
133 | // correct the position taking in to account the card is not | 135 | // correct the position taking in to account the card is not |
@@ -136,3 +138,3 @@ public: | |||
136 | newTopCard->flipTo( top.x(), top.y() ); | 138 | newTopCard->flipTo( top.x(), top.y() ); |
137 | top = QPoint( top.x(), top.y() + 13 ); | 139 | top = QPoint( top.x(), top.y() + offsetDown ); |
138 | } | 140 | } |
@@ -147,3 +149,4 @@ public: | |||
147 | if (card->isFacing()) { | 149 | if (card->isFacing()) { |
148 | y += 13; | 150 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; |
151 | y += offsetDown; | ||
149 | } else { | 152 | } else { |