-rw-r--r-- | noncore/games/solitaire/canvascardgame.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/noncore/games/solitaire/canvascardgame.cpp b/noncore/games/solitaire/canvascardgame.cpp index 32635a0..ef35287 100644 --- a/noncore/games/solitaire/canvascardgame.cpp +++ b/noncore/games/solitaire/canvascardgame.cpp | |||
@@ -26,12 +26,13 @@ | |||
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
28 | 28 | ||
29 | #include <qmainwindow.h> | 29 | #include <qmainwindow.h> |
30 | #include <qpe/qpemenubar.h> | 30 | #include <qpe/qpemenubar.h> |
31 | #include <qpainter.h> | 31 | #include <qpainter.h> |
32 | #include <qgfx_qws.h> | ||
32 | 33 | ||
33 | #include <stdlib.h> | 34 | #include <stdlib.h> |
34 | #include <limits.h> | 35 | #include <limits.h> |
35 | #include <time.h> | 36 | #include <time.h> |
36 | #include <math.h> | 37 | #include <math.h> |
37 | 38 | ||
@@ -68,20 +69,24 @@ private: | |||
68 | int animSteps; | 69 | int animSteps; |
69 | }; | 70 | }; |
70 | 71 | ||
71 | 72 | ||
72 | void CanvasCardPile::addCard( CanvasCard *card ) | 73 | void CanvasCardPile::addCard( CanvasCard *card ) |
73 | { | 74 | { |
75 | int offsetDown = ( qt_screen->deviceWidth() < 200 ) ? 9 : 13; | ||
76 | int cardHeight = ( qt_screen->deviceWidth() < 200 ) ? 27 : 36; | ||
77 | int cardWidth = ( qt_screen->deviceWidth() < 200 ) ? 20 : 23; | ||
78 | |||
74 | if ( !firstCard ) | 79 | if ( !firstCard ) |
75 | firstCard = card; | 80 | firstCard = card; |
76 | 81 | ||
77 | int height = 36 + pileHeight * 13; | 82 | int height = cardHeight + pileHeight * offsetDown; |
78 | setSize( 23, height ); | 83 | setSize( cardWidth, height ); |
79 | pile->resize( 23, height ); | 84 | pile->resize( cardWidth, height ); |
80 | QPainter p( pile ); | 85 | QPainter p( pile ); |
81 | p.translate( -card->x(), -card->y() + pileHeight * 13 ); | 86 | p.translate( -card->x(), -card->y() + pileHeight * offsetDown ); |
82 | card->draw( p ); | 87 | card->draw( p ); |
83 | pileHeight++; | 88 | pileHeight++; |
84 | 89 | ||
85 | QImage tempImage; | 90 | QImage tempImage; |
86 | tempImage = *pile; | 91 | tempImage = *pile; |
87 | tempImage32 = tempImage.convertDepth( 32 ); | 92 | tempImage32 = tempImage.convertDepth( 32 ); |
@@ -96,23 +101,23 @@ void CanvasCardPile::addCard( CanvasCard *card ) | |||
96 | 101 | ||
97 | QRgb alpha = qRgba( 0, 0, 0, 0 ); | 102 | QRgb alpha = qRgba( 0, 0, 0, 0 ); |
98 | tempImage32.setPixel( 1, 0, alpha ); | 103 | tempImage32.setPixel( 1, 0, alpha ); |
99 | tempImage32.setPixel( 0, 0, alpha ); | 104 | tempImage32.setPixel( 0, 0, alpha ); |
100 | tempImage32.setPixel( 0, 1, alpha ); | 105 | tempImage32.setPixel( 0, 1, alpha ); |
101 | 106 | ||
102 | tempImage32.setPixel( 21, 0, alpha ); | 107 | tempImage32.setPixel( cardWidth - 2, 0, alpha ); |
103 | tempImage32.setPixel( 22, 0, alpha ); | 108 | tempImage32.setPixel( cardWidth - 1, 0, alpha ); |
104 | tempImage32.setPixel( 22, 1, alpha ); | 109 | tempImage32.setPixel( cardWidth - 1, 1, alpha ); |
105 | height--; | 110 | height--; |
106 | tempImage32.setPixel( 1, height, alpha ); | 111 | tempImage32.setPixel( 1, height, alpha ); |
107 | tempImage32.setPixel( 0, height - 1, alpha ); | 112 | tempImage32.setPixel( 0, height - 1, alpha ); |
108 | tempImage32.setPixel( 0, height, alpha ); | 113 | tempImage32.setPixel( 0, height, alpha ); |
109 | 114 | ||
110 | tempImage32.setPixel( 21, height, alpha ); | 115 | tempImage32.setPixel( cardWidth - 2, height, alpha ); |
111 | tempImage32.setPixel( 22, height, alpha ); | 116 | tempImage32.setPixel( cardWidth - 1, height, alpha ); |
112 | tempImage32.setPixel( 22, height - 1, alpha ); | 117 | tempImage32.setPixel( cardWidth - 1, height - 1, alpha ); |
113 | } | 118 | } |
114 | 119 | ||
115 | 120 | ||
116 | void CanvasCardPile::advance(int stage) | 121 | void CanvasCardPile::advance(int stage) |
117 | { | 122 | { |
118 | if ( stage==1 ) { | 123 | if ( stage==1 ) { |
@@ -130,13 +135,13 @@ void CanvasCardPile::advance(int stage) | |||
130 | } | 135 | } |
131 | } | 136 | } |
132 | QCanvasRectangle::advance(stage); | 137 | QCanvasRectangle::advance(stage); |
133 | } | 138 | } |
134 | 139 | ||
135 | 140 | ||
136 | void CanvasCardPile::animatedMove(int x2, int y2, int steps = 7 ) | 141 | void CanvasCardPile::animatedMove(int x2, int y2, int steps ) |
137 | { | 142 | { |
138 | destX = x2; | 143 | destX = x2; |
139 | destY = y2; | 144 | destY = y2; |
140 | 145 | ||
141 | double x1 = x(), y1 = y(), dx = x2 - x1, dy = y2 - y1; | 146 | double x1 = x(), y1 = y(), dx = x2 - x1, dy = y2 - y1; |
142 | 147 | ||