Diffstat (limited to 'noncore/games/solitaire/patiencecardgame.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/solitaire/patiencecardgame.cpp | 49 |
1 files changed, 36 insertions, 13 deletions
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 | |||
@@ -14,36 +14,53 @@ | |||
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qgfx_qws.h> | ||
20 | #include "patiencecardgame.h" | 21 | #include "patiencecardgame.h" |
21 | 22 | ||
22 | 23 | ||
23 | int highestZ = 0; | 24 | int highestZ = 0; |
24 | 25 | ||
25 | 26 | ||
26 | PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent) | 27 | PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent) |
27 | { | 28 | { |
28 | numberOfTimesThroughDeck = 0; | 29 | numberOfTimesThroughDeck = 0; |
29 | highestZ = 0; | 30 | highestZ = 0; |
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 | } |
45 | 62 | ||
46 | 63 | ||
47 | PatienceCardGame::~PatienceCardGame() | 64 | PatienceCardGame::~PatienceCardGame() |
48 | { | 65 | { |
49 | delete circleCross; | 66 | delete circleCross; |
@@ -170,13 +187,16 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) | |||
170 | 187 | ||
171 | // Added Code | 188 | // Added Code |
172 | faceDownDealingPile->removeCard(item); | 189 | faceDownDealingPile->removeCard(item); |
173 | faceUpDealingPile->addCardToTop(item); | 190 | faceUpDealingPile->addCardToTop(item); |
174 | item->setCardPile( faceUpDealingPile ); | 191 | item->setCardPile( faceUpDealingPile ); |
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 | } |
178 | moving = NULL; | 198 | moving = NULL; |
179 | moved = FALSE; | 199 | moved = FALSE; |
180 | 200 | ||
181 | // move two other cards if we flip three at a time | 201 | // move two other cards if we flip three at a time |
182 | int flipped = 1; | 202 | int flipped = 1; |
@@ -192,13 +212,16 @@ bool PatienceCardGame::mousePressCard( Card *card, QPoint p ) | |||
192 | 212 | ||
193 | // Added Code | 213 | // Added Code |
194 | faceDownDealingPile->removeCard(item); | 214 | faceDownDealingPile->removeCard(item); |
195 | faceUpDealingPile->addCardToTop(item); | 215 | faceUpDealingPile->addCardToTop(item); |
196 | item->setCardPile( faceUpDealingPile ); | 216 | item->setCardPile( faceUpDealingPile ); |
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 | } |
200 | } | 223 | } |
201 | 224 | ||
202 | return TRUE; | 225 | return TRUE; |
203 | } | 226 | } |
204 | 227 | ||