summaryrefslogtreecommitdiff
path: root/noncore/games/solitaire/canvascard.cpp
Unidiff
Diffstat (limited to 'noncore/games/solitaire/canvascard.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/solitaire/canvascard.cpp31
1 files changed, 31 insertions, 0 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,2 +105,8 @@ CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) :
104 if ( !cardsFaces ) { 105 if ( !cardsFaces ) {
106 if ( qt_screen->deviceWidth() < 200 ) {
107 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) );
108 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) );
109 cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) );
110 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) );
111 } else {
105 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); 112 cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) );
@@ -108,2 +115,3 @@ CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) :
108 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); 115 cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) );
116 }
109 cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); 117 cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars );
@@ -128,2 +136,16 @@ void CanvasCard::setCardBack(int b)
128 136
137 if ( qt_screen->deviceWidth() < 200 ) {
138 switch (cardBack) {
139 case 0:
140 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break;
141 case 1:
142 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break;
143 case 2:
144 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break;
145 case 3:
146 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break;
147 case 4:
148 cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break;
149 }
150 } else {
129 switch (cardBack) { 151 switch (cardBack) {
@@ -140,2 +162,3 @@ void CanvasCard::setCardBack(int b)
140 } 162 }
163 }
141 164
@@ -183,2 +206,9 @@ void CanvasCard::draw(QPainter &painter)
183 206
207 if ( qt_screen->deviceWidth() < 200 ) {
208 p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
209 p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 );
210 p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 );
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 {
184 p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); 214 p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
@@ -188,2 +218,3 @@ void CanvasCard::draw(QPainter &painter)
188 p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); 218 p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 );
219 }
189 220