summaryrefslogtreecommitdiff
path: root/noncore/games/solitaire
Side-by-side diff
Diffstat (limited to 'noncore/games/solitaire') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/solitaire/canvascard.cpp5
-rw-r--r--noncore/games/solitaire/canvascardgame.cpp8
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp5
-rw-r--r--noncore/games/solitaire/canvasshapes.cpp2
-rw-r--r--noncore/games/solitaire/card.cpp3
-rw-r--r--noncore/games/solitaire/cardpile.cpp2
-rw-r--r--noncore/games/solitaire/chicanecardgame.cpp1
-rw-r--r--noncore/games/solitaire/freecellcardgame.cpp1
-rw-r--r--noncore/games/solitaire/harpcardgame.cpp1
-rw-r--r--noncore/games/solitaire/main.cpp1
-rw-r--r--noncore/games/solitaire/patiencecardgame.cpp1
-rw-r--r--noncore/games/solitaire/teeclubcardgame.cpp1
12 files changed, 0 insertions, 31 deletions
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp
index 7c4a5ba..c36da6c 100644
--- a/noncore/games/solitaire/canvascard.cpp
+++ b/noncore/games/solitaire/canvascard.cpp
@@ -1,53 +1,48 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include "cardgame.h"
#include "canvascard.h"
#include <qpe/resource.h>
-#include <qpainter.h>
-#include <qimage.h>
-#include <qpaintdevice.h>
-#include <qbitmap.h>
#include <qgfx_qws.h> // Needed to get the device's width
#include <math.h>
#if defined( QT_QWS_CASSIOPEIA )
#define SLOW_HARDWARE
#endif
// Seems to be fast enough to me even without Transformations in the library
//#if defined( QT_NO_TRANSFORMATIONS ) && defined( QT_QWS_IPAQ )
//#define SLOW_HARDWARE
//#endif
QBitmap *Create180RotatedBitmap(QBitmap *srcBitmap)
{
#ifdef QT_NO_TRANSFORMATIONS
int w = srcBitmap->width();
int h = srcBitmap->height();
QBitmap *dstBitmap = new QBitmap( w, h );
// ### this is very poorly implemented and probably could be much faster
for (int i = 0; i < w; i++)
for (int j = 0; j < h; j++)
bitBlt( dstBitmap, i, j, srcBitmap, w - i - 1, h - j - 1, 1, 1 );
diff --git a/noncore/games/solitaire/canvascardgame.cpp b/noncore/games/solitaire/canvascardgame.cpp
index 9ae2a23..ed5748e 100644
--- a/noncore/games/solitaire/canvascardgame.cpp
+++ b/noncore/games/solitaire/canvascardgame.cpp
@@ -1,55 +1,47 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include "cardgame.h"
-#include "canvasshapes.h"
-#include "canvascard.h"
#include "canvascardgame.h"
-#include <qpe/resource.h>
-#include <qpe/config.h>
-#include <qmainwindow.h>
-#include <qmenubar.h>
-#include <qpainter.h>
#include <qgfx_qws.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
#include <math.h>
extern int highestZ;
class CanvasCardPile : public QCanvasRectangle
{
public:
CanvasCardPile( CanvasCardGame *ccg, QCanvas *canvas ) : QCanvasRectangle( canvas ), parent( ccg ) {
pile = new QPixmap( 0, 0 );
pileHeight = 0;
firstCard = NULL;
}
void addCard( CanvasCard *card );
void advance(int stage);
void animatedMove() { animatedMove(savedX, savedY); }
void savePos(void) { savedX = (int)x(); savedY = (int)y(); }
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp
index c12344a..503bc92 100644
--- a/noncore/games/solitaire/canvascardwindow.cpp
+++ b/noncore/games/solitaire/canvascardwindow.cpp
@@ -1,56 +1,51 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "canvascardwindow.h"
-#include "patiencecardgame.h"
#include "freecellcardgame.h"
#include "chicanecardgame.h"
#include "harpcardgame.h"
#include "teeclubcardgame.h"
-#include <qpe/resource.h>
-#include <qmainwindow.h>
-#include <qpopupmenu.h>
-#include <qstyle.h>
CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0),
cardGame(NULL)
{
setIcon( Resource::loadPixmap( "cards" ) );
setCaption(tr("Patience"));
// Create Playing Area for Games
if ( QPixmap::defaultDepth() < 12 ) {
// canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B));
// canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50));
canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D));
} else {
QPixmap bg;
bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither );
canvas.setBackgroundPixmap(bg);
}
#if defined( QT_QWS_CASSIOPEIA )
canvas.setAdvancePeriod(70);
#else
canvas.setAdvancePeriod(30);
diff --git a/noncore/games/solitaire/canvasshapes.cpp b/noncore/games/solitaire/canvasshapes.cpp
index 6ccd4a4..011958d 100644
--- a/noncore/games/solitaire/canvasshapes.cpp
+++ b/noncore/games/solitaire/canvasshapes.cpp
@@ -1,45 +1,43 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qpainter.h>
-#include <qcanvas.h>
#include <qgfx_qws.h>
#include "canvasshapes.h"
CanvasRoundRect::CanvasRoundRect(int x, int y, QCanvas *canvas) :
QCanvasRectangle( x, y, ( qt_screen->deviceWidth() < 200 ) ? 20 : 23, ( qt_screen->deviceWidth() < 200 ) ? 27 : 36, canvas)
{
setZ(0);
show();
}
void CanvasRoundRect::redraw()
{
hide();
show();
}
void CanvasRoundRect::drawShape(QPainter &p)
{
if ( qt_screen->deviceWidth() < 200 )
p.drawRoundRect( (int)x() + 1, (int)y() + 1, 18, 25);
else
diff --git a/noncore/games/solitaire/card.cpp b/noncore/games/solitaire/card.cpp
index 609e280..52e38ac 100644
--- a/noncore/games/solitaire/card.cpp
+++ b/noncore/games/solitaire/card.cpp
@@ -1,50 +1,47 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "card.h"
-#include <qpe/config.h>
-#include <qpoint.h>
-#include <qlist.h>
/*
Card( eValue v, eSuit s, bool f ) :
val(v), suit(s), faceUp(f), showing(FALSE), ix(0), iy(0), iz(0), cardPile(NULL) { }
virtual ~Card() { }
eValue getValue() { return val; }
eSuit getSuit() { return suit; }
CardPile *getCardPile() { return cardPile; }
bool isFacing() { return faceUp; }
bool isShowing() { return showing; }
bool isRed() { return ((suit == diamonds) || (suit == hearts)); }
int getX(void) { return ix; }
int getY(void) { return iy; }
int getZ(void) { return iz; }
void setCardPile(CardPile *p) { cardPile = p; }
void setFace(bool f) { faceUp = f; }
void flip(void) { flipTo(getX(), getY()); }
virtual void setPos(int x, int y, int z) { ix = x; iy = y; iz = z; }
virtual void move(int x, int y) { ix = x; iy = y; }
virtual void move(QPoint p) { ix = p.x(); iy = p.y(); }
virtual void flipTo(int x, int y, int steps = 8) { ix = x; iy = y; faceUp = !faceUp; redraw(); Q_UNUSED(steps); }
virtual void showCard(void) { showing = TRUE; }
virtual void hideCard(void) { showing = FALSE; }
virtual void redraw(void) { }
diff --git a/noncore/games/solitaire/cardpile.cpp b/noncore/games/solitaire/cardpile.cpp
index aace2e2..1d572be 100644
--- a/noncore/games/solitaire/cardpile.cpp
+++ b/noncore/games/solitaire/cardpile.cpp
@@ -1,51 +1,49 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "cardpile.h"
#include "card.h"
#include <qpe/config.h>
-#include <qpoint.h>
-#include <qlist.h>
CardPile::CardPile(int x, int y) : pileX(x), pileY(y), dealing(FALSE), PileResize(FALSE) {
pileWidth = 0;
pileHeight = 0;
pileNextX = pileX;
pileNextY = pileY;
pileCenterX = x + pileWidth / 2;
pileCenterY = y + pileHeight / 2;
pileRadius = (pileWidth > pileHeight) ? pileWidth : pileHeight;
pileOffsetDown = 13;
}
int CardPile::distanceFromPile(int x, int y) {
return (pileCenterX-x)*(pileCenterX-x)+(pileCenterY-y)*(pileCenterY-y);
}
int CardPile::distanceFromNextPos(int x, int y) {
return (pileNextX-x)*(pileNextX-x)+(pileNextY-y)*(pileNextY-y);
}
diff --git a/noncore/games/solitaire/chicanecardgame.cpp b/noncore/games/solitaire/chicanecardgame.cpp
index 6729a94..6c607b9 100644
--- a/noncore/games/solitaire/chicanecardgame.cpp
+++ b/noncore/games/solitaire/chicanecardgame.cpp
@@ -5,49 +5,48 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**
** created on base of patiencecardgame by cam (C.A.Mader) 2002
** Rules for this game:
** use 2 decks = 104 cards
** deal 8 rows with 3 hidden cards and one open card
** append red to black and vice versa
** each card can be layed on a free place
** deal 8 cards at once
**
**********************************************************************/
-#include <qgfx_qws.h>
#include "chicanecardgame.h"
extern int highestZ;
ChicaneCardGame::ChicaneCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2) // Use 2 Decks
{
highestZ = 0;
for (int i = 0; i < 8; i++) {
discardPiles[i] = new ChicaneDiscardPile( 27 + i * 26, 10, canvas() );
addCardPile(discardPiles[i]);
}
for (int i = 0; i < 8; i++) {
workingPiles[i] = new ChicaneWorkingPile( 27 + i * 26, 50, canvas() );
addCardPile(workingPiles[i]);
}
faceDownDealingPile = new ChicaneFaceDownDeck( 2, 10, canvas() );
}
void ChicaneCardGame::deal(void)
{
diff --git a/noncore/games/solitaire/freecellcardgame.cpp b/noncore/games/solitaire/freecellcardgame.cpp
index aeb32fc..d474f4e 100644
--- a/noncore/games/solitaire/freecellcardgame.cpp
+++ b/noncore/games/solitaire/freecellcardgame.cpp
@@ -1,44 +1,43 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qgfx_qws.h>
#include "freecellcardgame.h"
extern int highestZ;
int numberOfFreeCells = 4;
FreecellCardGame::FreecellCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent)
{
numberOfFreeCells = 4;
highestZ = 0;
int spaceBetweenPiles = ( qt_screen->deviceWidth() < 200 ) ? 21 : 28;
int xOrigin = ( qt_screen->deviceWidth() < 200 ) ? 0 : 5;
int spacing = ( qt_screen->deviceWidth() < 200 ) ? 0 : 0;
for (int i = 0; i < 4; i++) {
freecellPiles[i] = new FreecellFreecellPile( xOrigin + i * spaceBetweenPiles, 10, canvas() );
addCardPile(freecellPiles[i]);
}
for (int i = 0; i < 4; i++) {
discardPiles[i] = new FreecellDiscardPile( xOrigin + spacing + 6 + (i + 4) * spaceBetweenPiles, 10, canvas() );
addCardPile(discardPiles[i]);
}
diff --git a/noncore/games/solitaire/harpcardgame.cpp b/noncore/games/solitaire/harpcardgame.cpp
index 0711622..d13d73b 100644
--- a/noncore/games/solitaire/harpcardgame.cpp
+++ b/noncore/games/solitaire/harpcardgame.cpp
@@ -7,49 +7,48 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**
** created on base of patiencecardgame by cam (C.A.Mader) 2002
** Rules for this game:
** use 2 decks = 104 cards
** deal 8 rows with one open card in the first place
** one hidden and one open in the second place and so on
** append red to black and vice versa
** each card can be layed on a free place
** deal 8 cards at once
**
**
**********************************************************************/
-#include <qgfx_qws.h>
#include "harpcardgame.h"
extern int highestZ;
HarpCardGame::HarpCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2) // Use 2 Decks
{
highestZ = 0;
for (int i = 0; i < 8; i++) {
discardPiles[i] = new HarpDiscardPile( 27 + i * 26, 10, canvas() );
addCardPile(discardPiles[i]);
}
for (int i = 0; i < 8; i++) {
workingPiles[i] = new HarpWorkingPile( 27 + i * 26, 50, canvas() );
addCardPile(workingPiles[i]);
}
faceDownDealingPile = new HarpFaceDownDeck( 2, 10, canvas() );
}
void HarpCardGame::deal(void)
{
diff --git a/noncore/games/solitaire/main.cpp b/noncore/games/solitaire/main.cpp
index bd3cf8b..9301171 100644
--- a/noncore/games/solitaire/main.cpp
+++ b/noncore/games/solitaire/main.cpp
@@ -1,26 +1,25 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "canvascardwindow.h"
-#include <qpe/qpeapplication.h>
#include <opie/oapplicationfactory.h>
OPIE_EXPORT_APP( OApplicationFactory<CanvasCardWindow> ) \ No newline at end of file
diff --git a/noncore/games/solitaire/patiencecardgame.cpp b/noncore/games/solitaire/patiencecardgame.cpp
index 96a599c..756577a 100644
--- a/noncore/games/solitaire/patiencecardgame.cpp
+++ b/noncore/games/solitaire/patiencecardgame.cpp
@@ -1,44 +1,43 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#include <qgfx_qws.h>
#include "patiencecardgame.h"
int highestZ = 0;
PatienceCardGame::PatienceCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent)
{
numberOfTimesThroughDeck = 0;
highestZ = 0;
if ( qt_screen->deviceWidth() < 200 )
{
circleCross = new CanvasCircleOrCross( 7, 16, canvas() );
rectangle = new CanvasRoundRect( 30, 10, canvas() );
for (int i = 0; i < 4; i++)
{
discardPiles[i] = new PatienceDiscardPile( 78 + i * 23, 10, canvas() );
addCardPile(discardPiles[i]);
}
for (int i = 0; i < 7; i++)
{
workingPiles[i] = new PatienceWorkingPile( 5 + i * 23, 50, canvas() );
diff --git a/noncore/games/solitaire/teeclubcardgame.cpp b/noncore/games/solitaire/teeclubcardgame.cpp
index 0941e0d..b1af757 100644
--- a/noncore/games/solitaire/teeclubcardgame.cpp
+++ b/noncore/games/solitaire/teeclubcardgame.cpp
@@ -7,49 +7,48 @@
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**
** created on base of patiencecardgame by cam (C.A.Mader) 2002
** Rules for this game:
** use 2 decks = 104 cards
** deal 9 rows with 5 open cards each
** append one card to each other card which is one step higher
** move only columns of cards which are equal in suit
** each card can be layed on a free place
** deal 1 card at once on the first pile
**
**
**********************************************************************/
-#include <qgfx_qws.h>
#include "teeclubcardgame.h"
extern int highestZ;
TeeclubCardGame::TeeclubCardGame(QCanvas *c, bool snap, QWidget *parent) : CanvasCardGame(*c, snap, parent, 2) // Use 2 Decks
{
highestZ = 0;
for (int i = 0; i < 8; i++) {
discardPiles[i] = new TeeclubDiscardPile( 27 + i * 26, 10, canvas() );
addCardPile(discardPiles[i]);
}
for (int i = 0; i < 9; i++) {
workingPiles[i] = new TeeclubWorkingPile( 2 + i * 26, 50, canvas() );
addCardPile(workingPiles[i]);
}
faceDownDealingPile = new TeeclubFaceDownDeck( 2, 10, canvas() );
}
void TeeclubCardGame::deal(void)
{