-rw-r--r-- | noncore/games/go/gowidget.cpp | 15 | ||||
-rw-r--r-- | noncore/games/minesweep/minefield.h | 30 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.cpp | 35 | ||||
-rw-r--r-- | noncore/games/snake/interface.h | 2 | ||||
-rw-r--r-- | noncore/games/snake/obstacle.cpp | 35 | ||||
-rw-r--r-- | noncore/games/snake/obstacle.h | 4 | ||||
-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 | ||||
-rw-r--r-- | noncore/games/wordgame/wordgame.cpp | 71 | ||||
-rw-r--r-- | noncore/games/wordgame/wordgame.h | 6 |
13 files changed, 291 insertions, 97 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 | |||
@@ -51,2 +51,4 @@ 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) : |
@@ -199,2 +201,15 @@ void GoWidget::resizeEvent( QResizeEvent * ) | |||
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 | } |
diff --git a/noncore/games/minesweep/minefield.h b/noncore/games/minesweep/minefield.h index 4ede435..1349c35 100644 --- a/noncore/games/minesweep/minefield.h +++ b/noncore/games/minesweep/minefield.h | |||
@@ -22,3 +22,3 @@ | |||
22 | 22 | ||
23 | #include <qtable.h> | 23 | #include <qscrollview.h> |
24 | 24 | ||
@@ -27,3 +27,3 @@ class Config; | |||
27 | 27 | ||
28 | class MineField : public QTable | 28 | class MineField : public QScrollView |
29 | { | 29 | { |
@@ -43,2 +43,3 @@ public: | |||
43 | 43 | ||
44 | void setAvailableRect( const QRect & ); | ||
44 | public slots: | 45 | public slots: |
@@ -54,13 +55,18 @@ signals: | |||
54 | protected: | 55 | protected: |
55 | void paintFocus( QPainter*, const QRect& ); | 56 | |
56 | void viewportMousePressEvent( QMouseEvent* ); | 57 | void contentsMousePressEvent( QMouseEvent* ); |
57 | void viewportMouseReleaseEvent( QMouseEvent* ); | 58 | void contentsMouseReleaseEvent( QMouseEvent* ); |
58 | void keyPressEvent( QKeyEvent* ); | 59 | void keyPressEvent( QKeyEvent* ); |
59 | void keyReleaseEvent( QKeyEvent* ); | 60 | void keyReleaseEvent( QKeyEvent* ); |
60 | 61 | void drawContents( QPainter * p, int clipx, int clipy, int clipw, int cliph ); | |
62 | |||
61 | int getHint( int row, int col ); | 63 | int getHint( int row, int col ); |
62 | void setHint( Mine* ); | 64 | void setHint( int r, int c ); |
63 | void updateMine( int row, int col ); | 65 | void updateMine( int row, int col ); |
64 | void paletteChange( const QPalette & ); | 66 | void paletteChange( const QPalette & ); |
65 | 67 | void updateCell( int r, int c ); | |
68 | bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } | ||
69 | Mine *mine( int row, int col ) { return onBoard(row, col ) ? mines[row+numCols*col] : 0; } | ||
70 | const Mine *mine( int row, int col ) const { return onBoard(row, col ) ? mines[row+numCols*col] : 0; } | ||
71 | |||
66 | protected slots: | 72 | protected slots: |
@@ -71,2 +77,5 @@ protected slots: | |||
71 | private: | 77 | private: |
78 | int findCellSize(); | ||
79 | void setCellSize( int ); | ||
80 | |||
72 | State stat; | 81 | State stat; |
@@ -79,2 +88,4 @@ private: | |||
79 | int currCol; | 88 | int currCol; |
89 | int numRows, numCols; | ||
90 | |||
80 | int minecount; | 91 | int minecount; |
@@ -83,3 +94,6 @@ private: | |||
83 | int lev; | 94 | int lev; |
95 | QRect availableRect; | ||
96 | int cellSize; | ||
84 | QTimer *holdTimer; | 97 | QTimer *holdTimer; |
98 | Mine **mines; | ||
85 | }; | 99 | }; |
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp index 6492462..c84fe53 100644 --- a/noncore/games/minesweep/minesweep.cpp +++ b/noncore/games/minesweep/minesweep.cpp | |||
@@ -221,2 +221,19 @@ void ResultIndicator::timerEvent( QTimerEvent *te ) | |||
221 | 221 | ||
222 | class MineFrame : public QFrame | ||
223 | { | ||
224 | public: | ||
225 | MineFrame( QWidget *parent, const char *name = 0 ) | ||
226 | :QFrame( parent, name ) {} | ||
227 | void setField( MineField *f ) { field = f; } | ||
228 | protected: | ||
229 | void resizeEvent( QResizeEvent *e ) { | ||
230 | field->setAvailableRect( contentsRect()); | ||
231 | QFrame::resizeEvent(e); | ||
232 | } | ||
233 | private: | ||
234 | MineField *field; | ||
235 | }; | ||
236 | |||
237 | |||
238 | |||
222 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | 239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) |
@@ -228,4 +245,6 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
228 | 245 | ||
229 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 246 | QPEToolBar *toolBar = new QPEToolBar( this ); |
230 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 247 | toolBar->setHorizontalStretchable( TRUE ); |
248 | |||
249 | QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); | ||
231 | 250 | ||
@@ -237,5 +256,2 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
237 | menuBar->insertItem( tr("Game"), gameMenu ); | 256 | menuBar->insertItem( tr("Game"), gameMenu ); |
238 | |||
239 | QPEToolBar *toolBar = new QPEToolBar( this ); | ||
240 | toolBar->setHorizontalStretchable( TRUE ); | ||
241 | 257 | ||
@@ -267,13 +283,12 @@ MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | |||
267 | 283 | ||
268 | addToolBar( menuToolBar ); | ||
269 | addToolBar( toolBar ); | 284 | addToolBar( toolBar ); |
270 | 285 | ||
271 | QFrame *mainframe = new QFrame( this ); | 286 | MineFrame *mainframe = new MineFrame( this ); |
272 | mainframe->setFrameShape( QFrame::Box ); | 287 | mainframe->setFrameShape( QFrame::Box ); |
273 | mainframe->setFrameShadow( QFrame::Raised ); | 288 | mainframe->setFrameShadow( QFrame::Raised ); |
274 | mainframe->setMargin(5); | 289 | |
275 | mainframe->setLineWidth(2); | 290 | mainframe->setLineWidth(2); |
276 | QBoxLayout *box = new QVBoxLayout( mainframe ); | 291 | |
277 | field = new MineField( mainframe ); | 292 | field = new MineField( mainframe ); |
278 | box->addWidget( field, 0, AlignCenter ); | 293 | mainframe->setField( field ); |
279 | QFont fnt = field->font(); | 294 | QFont fnt = field->font(); |
diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h index 30c7f84..454d4ee 100644 --- a/noncore/games/snake/interface.h +++ b/noncore/games/snake/interface.h | |||
@@ -38,3 +38,2 @@ public: | |||
38 | void createTargets(); | 38 | void createTargets(); |
39 | void welcomescreen(); | ||
40 | 39 | ||
@@ -53,2 +52,3 @@ private slots: | |||
53 | void scoreInc(); | 52 | void scoreInc(); |
53 | void welcomescreen(); | ||
54 | 54 | ||
diff --git a/noncore/games/snake/obstacle.cpp b/noncore/games/snake/obstacle.cpp index 2d07fe7..4bdefa5 100644 --- a/noncore/games/snake/obstacle.cpp +++ b/noncore/games/snake/obstacle.cpp | |||
@@ -25,16 +25,35 @@ | |||
25 | 25 | ||
26 | Obstacle::Obstacle(QCanvas* canvas, int x, int y) | 26 | |
27 | : QCanvasSprite(0, canvas) | 27 | |
28 | Obstacle::Obstacle(QCanvas* canvas, int y) | ||
29 | : QCanvasSprite(0,canvas) | ||
28 | { | 30 | { |
29 | newObstacle(x, y); | 31 | newObstacle(y); |
30 | } | 32 | } |
31 | 33 | ||
32 | void Obstacle::newObstacle(int x, int y) | 34 | void Obstacle::newObstacle(int y) |
33 | { | 35 | { |
34 | QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(Resource::findPixmap("snake/wall.png")); | 36 | QPixmap obstaclePix( Resource::findPixmap("snake/wall.png") ); |
35 | 37 | ||
38 | if ( obstaclePix.width() > canvas()->width()*3/5 ) { | ||
39 | int w = canvas()->width()*3/5; | ||
40 | w = w - w % 16; | ||
41 | obstaclePix.resize( w, obstaclePix.height() ); | ||
42 | } | ||
43 | |||
44 | QList<QPixmap> pixl; | ||
45 | pixl.append( &obstaclePix ); | ||
46 | |||
47 | QPoint nullp; | ||
48 | QList<QPoint> pl; | ||
49 | pl.append( &nullp ); | ||
50 | |||
51 | QCanvasPixmapArray* obstaclearray = new QCanvasPixmapArray(pixl, pl); | ||
36 | setSequence(obstaclearray); | 52 | setSequence(obstaclearray); |
37 | 53 | ||
54 | int x = ( canvas()->width() - obstaclePix.width() )/2; | ||
55 | x = x - x % 16; | ||
56 | y = y - y % 16; | ||
38 | move(x, y); | 57 | move(x, y); |
39 | 58 | setZ( -100 ); | |
40 | show(); | 59 | show(); |
diff --git a/noncore/games/snake/obstacle.h b/noncore/games/snake/obstacle.h index 838917f..b3c7846 100644 --- a/noncore/games/snake/obstacle.h +++ b/noncore/games/snake/obstacle.h | |||
@@ -25,5 +25,5 @@ class Obstacle : public QCanvasSprite | |||
25 | public: | 25 | public: |
26 | Obstacle(QCanvas*, int x, int y); | 26 | Obstacle(QCanvas*, int y); |
27 | ~Obstacle(); | 27 | ~Obstacle(); |
28 | void newObstacle(int x, int y); | 28 | void newObstacle(int y); |
29 | int rtti() const; | 29 | int rtti() const; |
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 { |
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp index ca4352d..16d37b3 100644 --- a/noncore/games/wordgame/wordgame.cpp +++ b/noncore/games/wordgame/wordgame.cpp | |||
@@ -61,2 +61,9 @@ enum RuleEffects { | |||
61 | 61 | ||
62 | static int tile_smallw = 16; | ||
63 | static int tile_smallh = 16; | ||
64 | static int tile_bigw = 22; | ||
65 | static int tile_bigh = 22; | ||
66 | static int tile_stweak = -2; | ||
67 | static int tile_btweak = -1; | ||
68 | |||
62 | static const int rack_tiles=7; | 69 | static const int rack_tiles=7; |
@@ -113,2 +120,11 @@ WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : | |||
113 | { | 120 | { |
121 | if ( qApp->desktop()->width() < 240 ) { | ||
122 | tile_smallw = 10; | ||
123 | tile_smallh = 10; | ||
124 | tile_bigw = 16; | ||
125 | tile_bigh = 16; | ||
126 | tile_stweak = 0; | ||
127 | tile_btweak = 0; | ||
128 | } | ||
129 | |||
114 | setIcon( Resource::loadPixmap( "wordgame" ) ); | 130 | setIcon( Resource::loadPixmap( "wordgame" ) ); |
@@ -249,2 +265,3 @@ void WordGame::startGame(const QStringList& playerlist) | |||
249 | racks = new QWidgetStack(vbox); | 265 | racks = new QWidgetStack(vbox); |
266 | racks->setFixedHeight(TileItem::bigHeight()+2); | ||
250 | namelist.clear(); | 267 | namelist.clear(); |
@@ -285,3 +302,2 @@ bool WordGame::loadRules(const QString &name) | |||
285 | 302 | ||
286 | QPixmap bgshapes = Resource::loadPixmap(shapepixmap); | ||
287 | QString rule_shapes; | 303 | QString rule_shapes; |
@@ -299,2 +315,8 @@ bool WordGame::loadRules(const QString &name) | |||
299 | } | 315 | } |
316 | |||
317 | QImage shim = Resource::loadImage(shapepixmap); | ||
318 | shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight()); | ||
319 | QPixmap bgshapes; | ||
320 | bgshapes.convertFromImage(shim); | ||
321 | |||
300 | rule_effects[re++] = 100; // default bonus | 322 | rule_effects[re++] = 100; // default bonus |
@@ -683,3 +705,3 @@ int TileItem::smallWidth() | |||
683 | { | 705 | { |
684 | return 16; | 706 | return tile_smallw; |
685 | } | 707 | } |
@@ -688,3 +710,3 @@ int TileItem::smallHeight() | |||
688 | { | 710 | { |
689 | return 16; | 711 | return tile_smallh; |
690 | } | 712 | } |
@@ -693,3 +715,3 @@ int TileItem::bigWidth() | |||
693 | { | 715 | { |
694 | return 22; | 716 | return tile_bigw; |
695 | } | 717 | } |
@@ -698,3 +720,3 @@ int TileItem::bigHeight() | |||
698 | { | 720 | { |
699 | return 22; | 721 | return tile_bigh; |
700 | } | 722 | } |
@@ -722,5 +744,15 @@ void TileItem::drawShape(QPainter& p) | |||
722 | { | 744 | { |
723 | static QFont value_font("heletica",8); | 745 | static QFont *value_font=0; |
724 | static QFont big_font("smoothtimes",17); | 746 | static QFont *big_font=0; |
725 | static QFont small_font("smoothtimes",10); | 747 | static QFont *small_font=0; |
748 | if ( !value_font ) { | ||
749 | value_font = new QFont("helvetica",8); | ||
750 | if ( TileItem::bigWidth() < 20 ) { | ||
751 | big_font = new QFont("helvetica",12); | ||
752 | small_font = new QFont("helvetica",8); | ||
753 | } else { | ||
754 | big_font = new QFont("smoothtimes",17); | ||
755 | small_font = new QFont("smoothtimes",10); | ||
756 | } | ||
757 | } | ||
726 | 758 | ||
@@ -730,3 +762,3 @@ void TileItem::drawShape(QPainter& p) | |||
730 | if ( big ) { | 762 | if ( big ) { |
731 | p.setFont(value_font); | 763 | p.setFont(*value_font); |
732 | QString n = QString::number(t.value()); | 764 | QString n = QString::number(t.value()); |
@@ -735,9 +767,9 @@ void TileItem::drawShape(QPainter& p) | |||
735 | w *= n.length(); | 767 | w *= n.length(); |
736 | QRect valuearea(x()+width()-w-2,y()+height()-h+1,w,h); | 768 | QRect valuearea(x()+width()-w-1,y()+height()-h,w,h); |
737 | p.drawText(valuearea,AlignCenter,n); | 769 | p.drawText(valuearea,AlignCenter,n); |
738 | p.setFont(big_font); | 770 | p.setFont(*big_font); |
739 | area = QRect(x(),y(),width()-2,height()-1); | 771 | area = QRect(x(),y()+tile_btweak,width()-4,height()-1); |
740 | } else { | 772 | } else { |
741 | p.setFont(small_font); | 773 | p.setFont(*small_font); |
742 | area = QRect(x(),y()+2,width(),height()-2); | 774 | area = QRect(x()+1+tile_stweak,y()+1,width(),height()-3); |
743 | } | 775 | } |
@@ -752,2 +784,3 @@ Board::Board(QPixmap bgshapes, int w, int h, QWidget* parent) : | |||
752 | { | 784 | { |
785 | setFixedSize(w*TileItem::smallWidth(),h*TileItem::smallHeight()); | ||
753 | grid = new TileItem*[w*h]; | 786 | grid = new TileItem*[w*h]; |
@@ -766,2 +799,7 @@ Board::~Board() | |||
766 | 799 | ||
800 | QSize Board::sizeHint() const | ||
801 | { | ||
802 | return QSize(canvas()->width(),canvas()->height()); | ||
803 | } | ||
804 | |||
767 | void Board::writeConfig(Config& cfg) | 805 | void Board::writeConfig(Config& cfg) |
@@ -1183,2 +1221,7 @@ Rack::~Rack() | |||
1183 | 1221 | ||
1222 | QSize Rack::sizeHint() const | ||
1223 | { | ||
1224 | return QSize(-1,TileItem::bigHeight()+2); | ||
1225 | } | ||
1226 | |||
1184 | void Rack::clear() | 1227 | void Rack::clear() |
diff --git a/noncore/games/wordgame/wordgame.h b/noncore/games/wordgame/wordgame.h index 0ffa56a..f73c85a 100644 --- a/noncore/games/wordgame/wordgame.h +++ b/noncore/games/wordgame/wordgame.h | |||
@@ -150,2 +150,4 @@ public: | |||
150 | 150 | ||
151 | QSize sizeHint() const; | ||
152 | |||
151 | protected: | 153 | protected: |
@@ -213,2 +215,4 @@ public: | |||
213 | 215 | ||
216 | QSize sizeHint() const; | ||
217 | |||
214 | signals: | 218 | signals: |
@@ -333,3 +337,3 @@ private: | |||
333 | QToolBar* toolbar; | 337 | QToolBar* toolbar; |
334 | QVBox *vbox; | 338 | QWidget *vbox; |
335 | Board *board; | 339 | Board *board; |