summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp34
-rw-r--r--noncore/games/fifteen/fifteen.cpp16
-rw-r--r--noncore/games/mindbreaker/config.in2
-rw-r--r--noncore/games/mindbreaker/mindbreaker.cpp15
-rw-r--r--noncore/games/mindbreaker/opie-mindbreaker.control2
-rw-r--r--noncore/games/minesweep/minesweep.cpp5
-rw-r--r--noncore/games/parashoot/base.cpp5
-rw-r--r--noncore/games/parashoot/bullet.cpp5
-rw-r--r--noncore/games/parashoot/cannon.cpp5
-rw-r--r--noncore/games/parashoot/helicopter.cpp4
-rw-r--r--noncore/games/parashoot/interface.cpp10
-rw-r--r--noncore/games/parashoot/man.cpp7
-rw-r--r--noncore/games/solitaire/canvascard.cpp51
-rw-r--r--noncore/games/solitaire/canvascardgame.h1
-rw-r--r--noncore/games/solitaire/canvascardwindow.cpp7
-rw-r--r--noncore/games/tetrix/qtetrix.cpp4
-rw-r--r--noncore/games/wordgame/wordgame.cpp22
-rw-r--r--noncore/games/zlines/ballpainter.cpp4
18 files changed, 97 insertions, 102 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index c286a36..31835f8 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,54 +1,54 @@
#include "backgammon.h"
#include "aidialog.h"
#include "filedialog.h"
#include "playerdialog.h"
#include "rulesdialog.h"
#include "themedialog.h"
/* OPIE */
#include <opie2/odebug.h>
+#include <opie2/oresource.h>
#include <qpe/qpeapplication.h>
#include <qpe/config.h>
-#include <qpe/resource.h>
using namespace Opie::Core;
/* QT */
#include <qfile.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtimer.h>
#include <qmenubar.h>
#include <stdlib.h>
BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
: QMainWindow(parent, name, fl)
{
if (!name) setName("BackGammon");
setCaption(tr( "Backgammon") );
- setIcon( Resource::loadPixmap( "backgammon" ) );
+ setIcon( Opie::Core::OResource::loadPixmap( "backgammon" ) );
//general counter varaible
int a=0;
//the game engine
move=new MoveEngine();
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
odebug << "config file does not exist" << oendl;
conf.setGroup("general");
conf.writeEntry("theme","default");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",false);
conf.writeEntry("nice_dice",false);
conf.setGroup("display");
conf.writeEntry("small",false);
conf.writeEntry("warning",true);
conf.setGroup("ai");
conf.writeEntry("rescue",6);
conf.writeEntry("eliminate",4);
conf.writeEntry("expose",1);
conf.writeEntry("protect",5);
conf.writeEntry("safe",3);
@@ -148,145 +148,145 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
//the marker
marker_current=new QCanvasRectangle(area);
marker_current->setBrush(QColor(0,0,255));
marker_current->setSize(15,5);
marker_current->setZ(1);
for(a=0;a<4;a++)
{
marker_next[a]=new QCanvasRectangle(area);
marker_next[a]->setBrush(QColor(0,255,0));
marker_next[a]->setSize(15,5);
marker_next[a]->setZ(1);
}
connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1()));
connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2()));
connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3()));
connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4()));
connect(move,SIGNAL(nomove()),this,SLOT(nomove()));
connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int)));
//the pieces
p1=new CanvasImageItem*[15];
p1_side=new CanvasImageItem*[15];
- QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name));
+ QImage piece_1_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesA_name));
QImage piece_1_front=piece_1_all.copy(0,0,15,15);
QImage piece_1_side=piece_1_all.copy(0,15,15,5);
p2=new CanvasImageItem*[15];
p2_side=new CanvasImageItem*[15];
- QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name));
+ QImage piece_2_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesB_name));
QImage piece_2_front=piece_2_all.copy(0,0,15,15);
QImage piece_2_side=piece_2_all.copy(0,15,15,5);
for(a=0;a<15;a++)
{
p1[a]=new CanvasImageItem(piece_1_front,area);
p1[a]->setSize(15,15);
p1_side[a]=new CanvasImageItem(piece_1_side,area);
p1_side[a]->setSize(15,5);
p2[a]=new CanvasImageItem(piece_2_front,area);
p2[a]->setSize(15,15);
p2_side[a]=new CanvasImageItem(piece_2_side,area);
p2_side[a]->setSize(15,5);
}
draw();
//the dice
- QImage dicebgA_all(Resource::loadImage("backgammon/dice/"+diceA_name));
+ QImage dicebgA_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceA_name));
diceA1=new CanvasImageItem*[7];
diceA2=new CanvasImageItem*[7];
- QImage dicebgB_all(Resource::loadImage("backgammon/dice/"+diceB_name));
+ QImage dicebgB_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceB_name));
diceB1=new CanvasImageItem*[7];
diceB2=new CanvasImageItem*[7];
- QImage oddsbg_all=(Resource::loadImage("backgammon/odds/"+odds_name));
+ QImage oddsbg_all=(Opie::Core::OResource::loadImage("backgammon/odds/"+odds_name));
//oddsDice=new CanvasImageItem*[6];
for(a=0;a<7;a++)
{
QImage dicebgA=dicebgA_all.copy(a*25,0,25,25);
diceA1[a]=new CanvasImageItem(dicebgA,area);
diceA1[a]->setX(5);
diceA1[a]->setY(205-2);
diceA1[a]->setZ(1);
diceA1[a]->setSize(25,25);
diceA2[a]=new CanvasImageItem(dicebgA,area);
diceA2[a]->setX(35);
diceA2[a]->setY(205-2);
diceA2[a]->setZ(1);
diceA2[a]->setSize(25,25);
QImage dicebgB=dicebgB_all.copy(a*25,0,25,25);
diceB1[a]=new CanvasImageItem(dicebgB,area);
diceB1[a]->setX(175);
diceB1[a]->setY(205-2);
diceB1[a]->setZ(1);
diceB1[a]->setSize(25,25);
diceB2[a]=new CanvasImageItem(dicebgB,area);
diceB2[a]->setX(205);
diceB2[a]->setY(205-2);
diceB2[a]->setZ(1);
diceB2[a]->setSize(25,25);
/*
if(a<6)
{
QImage oddsbg=oddsbg_all.copy(a*15,0,15,15);
oddsDice[a]=new CanvasImageItem(oddsbg,area);
oddsDice[a]->setX(110);
oddsDice[a]->setY(210-2);
oddsDice[a]->setZ(1);
oddsDice[a]->setSize(15,15);
oddsDice[a]->hide();
}
*/
}
//oddsDice[0]->show();
//set the board
- QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name));
+ QImage boardbg(Opie::Core::OResource::loadImage("backgammon/boards/"+board_name));
board=new CanvasImageItem(boardbg,area);
board->setX(0);
board->setY(0);
board->setZ(0);
board->setSize(235-2,200-2);
board->show();
//the table
- QImage tablebg(Resource::loadImage("backgammon/table/"+table_name));
+ QImage tablebg(Opie::Core::OResource::loadImage("backgammon/table/"+table_name));
table=new CanvasImageItem(tablebg,area);
table->setX(0);
table->setY(200-2);
table->setZ(0);
table->setSize(235-2,20);
table->show();
//the no move marker
- QImage nomovebg(Resource::loadImage("backgammon/no_move"));
+ QImage nomovebg(Opie::Core::OResource::loadImage("backgammon/no_move"));
nomove_marker=new CanvasImageItem(nomovebg,area);
nomove_marker->setX(0);
nomove_marker->setY(200);
nomove_marker->setZ(2);
nomove_marker->hide();
//default human against computer
player1_auto=false;
player2_auto=true;
//start new game
newgame();
}
BackGammon::~BackGammon()
{
//DESTRUCTOR
}
void BackGammon::newgame()
{
gameFinished=false;
QDateTime now=QDateTime::currentDateTime();
game_name=now.date().toString()+"_"+now.time().toString();
move->reset();
@@ -903,73 +903,73 @@ void BackGammon::setplayer()
QTimer::singleShot(2000,this,SLOT(autoroll_dice2()));
}
else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2)
{
message->setText(tr( "<b>P1 turn</b>", "P means player" ));
dice_rolled=false;
player=1;
if(player1_auto)
QTimer::singleShot(2000,this,SLOT(autoroll_dice1()));
}
}
void BackGammon::autoroll_dice1()
{
mouse(20,210);
}
void BackGammon::autoroll_dice2()
{
mouse(170,210);
}
void BackGammon::applytheme()
{
- QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name));
+ QImage boardbg(Opie::Core::OResource::loadImage("backgammon/boards/"+board_name));
board->setImage(boardbg);
- QImage tablebg(Resource::loadImage("backgammon/table/"+table_name));
+ QImage tablebg(Opie::Core::OResource::loadImage("backgammon/table/"+table_name));
table->setImage(tablebg);
- QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name));
+ QImage piece_1_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesA_name));
QImage piece_1_front=piece_1_all.copy(0,0,15,15);
QImage piece_1_side=piece_1_all.copy(0,15,15,5);
- QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name));
+ QImage piece_2_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesB_name));
QImage piece_2_front=piece_2_all.copy(0,0,15,15);
QImage piece_2_side=piece_2_all.copy(0,15,15,5);
int a=0;
for(a=0;a<15;a++)
{
p1[a]->setImage(piece_1_front);
p1_side[a]->setImage(piece_1_side);
p2[a]->setImage(piece_2_front);
p2_side[a]->setImage(piece_2_side);
}
draw();
- QImage dicebgA_all(Resource::loadImage("backgammon/dice/"+diceA_name));
- QImage dicebgB_all(Resource::loadImage("backgammon/dice/"+diceB_name));
- QImage oddsbg_all=(Resource::loadImage("backgammon/odds/"+odds_name));
+ QImage dicebgA_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceA_name));
+ QImage dicebgB_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceB_name));
+ QImage oddsbg_all=(Opie::Core::OResource::loadImage("backgammon/odds/"+odds_name));
for(a=0;a<7;a++)
{
QImage dicebgA=dicebgA_all.copy(a*25,0,25,25);
diceA1[a]->setImage(dicebgA);
diceA2[a]->setImage(dicebgA);
QImage dicebgB=dicebgB_all.copy(a*25,0,25,25);
diceB1[a]->setImage(dicebgB);
diceB2[a]->setImage(dicebgB);
/*
if(a<6)
{
QImage oddsbg=oddsbg_all.copy(a*15,0,15,15);
oddsDice[a]->setImage(oddsbg);
}
*/
}
}
diff --git a/noncore/games/fifteen/fifteen.cpp b/noncore/games/fifteen/fifteen.cpp
index bb57ee1..c41c0a4 100644
--- a/noncore/games/fifteen/fifteen.cpp
+++ b/noncore/games/fifteen/fifteen.cpp
@@ -2,110 +2,102 @@
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "fifteen.h"
#include "fifteenconfigdialog.h"
#include <opie2/ofileselector.h>
+#include <opie2/oresource.h>
-#include <qtopia/resource.h>
#include <qtopia/config.h>
#include <qtopia/qpeapplication.h>
#include <qvbox.h>
#include <qaction.h>
#include <qpainter.h>
#include <qmessagebox.h>
#include <qtoolbar.h>
#include <qmenubar.h>
#include <qimage.h>
#include <stdlib.h>
#include <time.h>
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
// random seed
srand(time(0));
setCaption( tr("Fifteen Pieces") );
QToolBar *toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( FALSE );
QMenuBar *menubar = new QMenuBar( toolbar );
menubar->setMargin(0);
QPopupMenu *game = new QPopupMenu( this );
+ menubar->insertItem( tr( "Game" ), game );
QWidget *spacer = new QWidget( toolbar );
spacer->setBackgroundMode( PaletteButton );
toolbar->setStretchableWidget( spacer );
setToolBarsMovable( FALSE );
QVBox *vbox = new QVBox( this );
PiecesTable *table = new PiecesTable( vbox );
setCentralWidget(vbox);
- QAction *a = new QAction( tr( "Randomize" ), Resource::loadPixmap( "new" ),
+ QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
a->addTo( game );
a->addTo( toolbar );
- a = new QAction( tr("Configure"), Resource::loadPixmap( "SettingsIcon" ),
+ a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
a->addTo( game );
-
- /* This is pointless and confusing.
- a = new QAction( tr( "Solve" ), Resource::loadIconSet( "repeat" ),
- QString::null, 0, this, 0 );
- connect( a, SIGNAL( activated() ), table, SLOT( slotReset() ) );
- a->addTo( game );
- a->addTo( toolbar );
- */
- menubar->insertItem( tr( "Game" ), game );
}
///////////////
/////// Pieces table Implementation
///////
PiecesTable::PiecesTable(QWidget* parent, const char* name )
: QTableView(parent, name), _menu(0), _randomized(false),
_dialog( 0l )
{
// setup table view
setFrameStyle(StyledPanel | Sunken);
setBackgroundMode(NoBackground);
setMouseTracking(true);
setNumRows(4);
setNumCols(4);
// init arrays
readConfig();
initColors();
diff --git a/noncore/games/mindbreaker/config.in b/noncore/games/mindbreaker/config.in
index b97a9e8..e3c0812 100644
--- a/noncore/games/mindbreaker/config.in
+++ b/noncore/games/mindbreaker/config.in
@@ -1,4 +1,4 @@
config MINDBREAKER
boolean "opie-mindbreaker (crack the coloured code)"
default "y"
- depends ( LIBQPE || LIBQPE-X11 )
+ depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE
diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp
index 1f554d2..aa4afd7 100644
--- a/noncore/games/mindbreaker/mindbreaker.cpp
+++ b/noncore/games/mindbreaker/mindbreaker.cpp
@@ -1,47 +1,48 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "mindbreaker.h"
-#include <qtopia/resource.h>
+#include <opie2/oresource.h>
+
#include <qtopia/config.h>
#include <qtopia/qpeapplication.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qmessagebox.h>
#include <qlayout.h>
#include <qtimer.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
static int pegRTTI = 3393393;
static int adjusted_panel_height;
static int adjusted_panel_width;
static int adjusted_bin_margin;
static int adjusted_peg_size;
static int adjusted_answerpeg_size;
static int adjusted_title_height;
static int adjusted_title_width;
@@ -118,67 +119,67 @@ public:
static void buildImages();
static QImage imageForType(int t);
static int eggLevel;
protected:
void drawShape(QPainter &);
private:
static QVector<QImage> normalPegs;
static QVector<QImage> specialPegs;
bool isplaced;
int pegtype;
int peg_go;
int peg_pos;
int aniStep;
};
int Peg::eggLevel = 0;
QVector<QImage> Peg::normalPegs;
QVector<QImage> Peg::specialPegs;
void Peg::buildImages()
{
- QImage pegs = Resource::loadImage("mindbreaker/pegs");
+ QImage pegs = Opie::Core::OResource::loadImage("mindbreaker/pegs");
int x = 0;
int y = 0;
int i;
eggLevel = 0;
normalPegs.resize(10);
for (i = 0; i < 6; i++) {
normalPegs.insert(i, new QImage(pegs.copy(x, y, peg_size, peg_size).
smoothScale(adjusted_peg_size, adjusted_peg_size) ));
x += peg_size;
}
specialPegs.resize(5);
for (i = 0; i < 5; i++) {
specialPegs.insert(i, new QImage(pegs.copy(x,y,peg_size, peg_size).
smoothScale(adjusted_peg_size, adjusted_peg_size) ));
x += peg_size;
}
- QImage image = Resource::loadImage("mindbreaker/mindbreaker");
+ QImage image = Opie::Core::OResource::loadImage("mindbreaker/mindbreaker");
/* copy from master image to functional images */
x = 0;
y = panel_height;
normalPegs.insert(8,
new QImage( image.copy(x, y, panel_width, panel_height).
smoothScale( adjusted_panel_width, adjusted_panel_height)
));
y += panel_height;
y += title_height;
normalPegs.insert(9,
new QImage(image.copy(x, y, title_width, title_height).
smoothScale( adjusted_title_width, adjusted_title_height)
));
y += title_height;
x = 6 * peg_size;
normalPegs.insert(6,
new QImage(image.copy(x, y, answerpeg_size, answerpeg_size).
smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) ));
x += answerpeg_size;
normalPegs.insert(7,
new QImage(image.copy(x, y, answerpeg_size, answerpeg_size).
smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) ));
}
@@ -268,51 +269,51 @@ inline int Peg::type() const
* and use these to create the tray, answer and board
*/
MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags )
: QMainWindow(parent, name, wFlags)
{
setCaption( tr("Mind Breaker"));
QPEApplication::setInputMethodHint( this, QPEApplication::AlwaysOff );
setMinimumSize(160,210);
QWidget *w = new QWidget( this );
w->setBackgroundColor( black );
QHBoxLayout *hb = new QHBoxLayout( w );
hb->addStretch();
board = new MindBreakerBoard(w);
hb->addWidget( board, 100 );
hb->addStretch();
setCentralWidget(w);
setToolBarsMovable( FALSE );
QToolBar *tb = new QToolBar(this);
tb->setHorizontalStretchable( TRUE );
- QIconSet newicon = Resource::loadIconSet("new");
- new QToolButton(newicon, tr("New Game"), 0,
- board, SLOT(clear()), tb, "NewGame");
+ QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), tr("New Game"), 0,
+ board, SLOT(clear()), tb, "NewGame");
+ btn->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
score = new QToolButton(tb);
score->setText("");
score->setMaximumHeight(20);
score->setUsesTextLabel(TRUE);
tb->setStretchableWidget(score);
connect(board, SIGNAL(scoreChanged(int,int)), this, SLOT(setScore(int,int)));
connect(score, SIGNAL(clicked()), board, SLOT(resetScore()));
int a, b;
board->getScore(&a, &b);
setScore(a,b);
layout()->setResizeMode(QLayout::FreeResize);
}
void MindBreaker::setScore(int turns, int games)
{
double average;
double total_turns = turns;
double total_games = games;
if(total_games > 0)
@@ -462,49 +463,49 @@ void MindBreakerBoard::fixSize()
void MindBreakerBoard::doFixSize()
{
QSize s = size();
int fw = frameWidth();
s.setWidth(s.width() - fw);
s.setHeight(s.height() - fw);
/* min size is 200 x 260 */
/*
if (s.width() < adjusted_board_width)
s.setWidth(adjusted_board_width);
if (s.height() < adjusted_board_height)
s.setHeight(adjusted_board_height);
*/
if ( current_highlight ) // non-first resize
writeConfig();
setupBoardSize(s.width() - fw, s.height() - fw);
canvas()->resize(s.width() - fw, s.height() - fw);
Peg::buildImages(); // must be done BEFORE any pegs are made
- QImage image = Resource::loadImage("mindbreaker/mindbreaker");
+ QImage image = Opie::Core::OResource::loadImage("mindbreaker/mindbreaker");
/* copy from master image to functional images */
int x = 0;
int y = 0;
panelImage = image.copy(x, y, panel_width, panel_height).
smoothScale( adjusted_panel_width, adjusted_panel_height);
y += panel_height;
y += panel_height;
titleImage = image.copy(x, y, title_width, title_height).
smoothScale( adjusted_title_width, adjusted_title_height);
show();
delete current_highlight;
current_highlight = new Peg(canvas(), 8);
current_highlight->setPlaced(TRUE);
current_highlight->setX(0);
current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height));
current_highlight->setZ(0);
current_highlight->show();
/* set up the game */
//readConfig();
diff --git a/noncore/games/mindbreaker/opie-mindbreaker.control b/noncore/games/mindbreaker/opie-mindbreaker.control
index 5b342da..d3826fd 100644
--- a/noncore/games/mindbreaker/opie-mindbreaker.control
+++ b/noncore/games/mindbreaker/opie-mindbreaker.control
@@ -1,10 +1,10 @@
Package: opie-mindbreaker
Files: plugins/application/libmindbreaker.so* bin/mindbreaker apps/Games/mindbreaker.desktop pics/mindbreaker
Priority: optional
Section: opie/games
Maintainer: Martin Imobersteg <imm@gmx.ch>
Architecture: arm
-Depends: task-opie-minimal
+Depends: task-opie-minimal, libopiecore2
Description: Game: crack the coloured code
A game for the Opie environment.
Version: $QPE_VERSION$EXTRAVERSION
diff --git a/noncore/games/minesweep/minesweep.cpp b/noncore/games/minesweep/minesweep.cpp
index c14609d..18449ff 100644
--- a/noncore/games/minesweep/minesweep.cpp
+++ b/noncore/games/minesweep/minesweep.cpp
@@ -1,49 +1,50 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "minesweep.h"
#include "minefield.h"
+#include <opie2/oresource.h>
+
#include <qtopia/qpeapplication.h>
-#include <qtopia/resource.h>
#include <qtopia/config.h>
#include <qtoolbar.h>
#include <qmenubar.h>
#include <qpushbutton.h>
#include <qlcdnumber.h>
#include <qtimer.h>
#include <qlabel.h>
#include <stdlib.h>
#include <time.h>
static const char *pix_new[]={
"20 20 3 1",
" c None",
"# c #00FF00",
". c #000000",
" ",
" ...... ",
" ..######.. ",
" .##########. ",
@@ -221,49 +222,49 @@ class MineFrame : public QFrame
public:
MineFrame( QWidget *parent, const char *name = 0 )
:QFrame( parent, name ), field(0) {}
void setField( MineField *f ) {
field = f;
setMinimumSize( field->sizeHint() );
}
protected:
void resizeEvent( QResizeEvent *e ) {
field->setAvailableRect( contentsRect());
QFrame::resizeEvent(e);
}
private:
MineField *field;
};
MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
srand(::time(0));
setCaption( tr("Mine Sweep") );
QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
- setIcon( Resource::loadPixmap( "minesweep/MineSweep" ) );
+ setIcon( Opie::Core::OResource::loadPixmap( "minesweep/MineSweep" ) );
QToolBar *toolBar = new QToolBar( this );
toolBar->setHorizontalStretchable( TRUE );
QMenuBar *menuBar = new QMenuBar( toolBar );
QPopupMenu *gameMenu = new QPopupMenu( this );
gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) );
gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) );
if (qApp->desktop()->width() >= 240) {
gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) );
}
menuBar->insertItem( tr("Game"), gameMenu );
guessLCD = new QLCDNumber( toolBar );
toolBar->setStretchableWidget( guessLCD );
QPalette lcdPal( red );
lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() );
lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() );
// guessLCD->setPalette( lcdPal );
diff --git a/noncore/games/parashoot/base.cpp b/noncore/games/parashoot/base.cpp
index 5f3c79d..f232536 100644
--- a/noncore/games/parashoot/base.cpp
+++ b/noncore/games/parashoot/base.cpp
@@ -1,58 +1,57 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "codes.h"
#include "base.h"
-#include <qtopia/resource.h>
-
+#include <opie2/oresource.h>
int damage;
Base::Base(QCanvas* canvas) :
QCanvasSprite(0, canvas),
kaboom("landmine"),
ohdear("crmble01")
{
basearray = new QCanvasPixmapArray();
- QString b0 = Resource::findPixmap("parashoot/b0001");
+ QString b0 = Opie::Core::OResource::findPixmap("parashoot/b0001");
b0.replace(QRegExp("0001"),"%1");
basearray->readPixmaps(b0, 4);
setSequence(basearray);
setFrame(0);
move(2, canvas->height()-50);
setZ(10);
show();
damage = 0;
}
void Base::damageBase()
{
damage++;
switch(damage) {
case 1: setFrame(1); ohdear.play(); break;
case 2: setFrame(2); ohdear.play(); break;
case 3: setFrame(3); kaboom.play(); break;
}
show();
}
bool Base::baseDestroyed()
{
diff --git a/noncore/games/parashoot/bullet.cpp b/noncore/games/parashoot/bullet.cpp
index 584f564..1f02251 100644
--- a/noncore/games/parashoot/bullet.cpp
+++ b/noncore/games/parashoot/bullet.cpp
@@ -2,61 +2,62 @@
** 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 "codes.h"
#include "bullet.h"
#include "man.h"
#include "helicopter.h"
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
+
#include <qpe/qmath.h>
int limit;
int shotcount;
int nobullets;
Bullet::Bullet(QCanvas* canvas, double angle, int cannonx, int cannony) :
QCanvasSprite(0, canvas),
bang("collide01")
{
- QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Resource::findPixmap("parashoot/bullet"));
+ QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Opie::Core::OResource::findPixmap("parashoot/bullet"));
setSequence(bulletarray);
if (nobullets < limit) {
nobullets++;
move(cannonx, cannony);
dy = 0;
dx = 0;
show();
setXY(angle);
setVelocity(-dx, -dy);
bang.play();
} else
return;
}
void Bullet::setXY(double angle)
{
double ang = angle;
if ( (y() < 0) || (x() < 0) || (y() > canvas()->height()) ||
(x() > canvas()->width()) )
delete this;
else {
double radians = 0;
radians = ang * 3.14159265/180;
dx = (qCos(radians)) *7;
diff --git a/noncore/games/parashoot/cannon.cpp b/noncore/games/parashoot/cannon.cpp
index 330d850..2f4c353 100644
--- a/noncore/games/parashoot/cannon.cpp
+++ b/noncore/games/parashoot/cannon.cpp
@@ -1,59 +1,58 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 <qtopia/resource.h>
-
+#include <opie2/oresource.h>
#include "codes.h"
#include "cannon.h"
Cannon::Cannon(QCanvas* canvas) :
QCanvasSprite(0, canvas)
{
shotsfired=0;
index = 8;
cannonx = 0;
cannony = 0;
cannonarray = new QCanvasPixmapArray();
- QString c0 = Resource::findPixmap("parashoot/can0001");
+ QString c0 = Opie::Core::OResource::findPixmap("parashoot/can0001");
c0.replace(QRegExp("0001"),"%1");
cannonarray->readPixmaps(c0,17);
setSequence(cannonarray);
setFrame(index);
reposition();
movedir = NoDir;
moveDelay = 0;
setAnimated(TRUE);
show();
}
void Cannon::advance(int stage)
{
if ( stage == 1 && moveDelay-- == 0 ) {
if (movedir == Left) {
if (index > 0) {
setFrame(index-1);
index--;
}
}
if (movedir == Right) {
if (index < 16) {
diff --git a/noncore/games/parashoot/helicopter.cpp b/noncore/games/parashoot/helicopter.cpp
index 7d91cd1..42adc34 100644
--- a/noncore/games/parashoot/helicopter.cpp
+++ b/noncore/games/parashoot/helicopter.cpp
@@ -1,61 +1,61 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "helicopter.h"
#include "man.h"
#include "codes.h"
-#include <qtopia/resource.h>
+#include <opie2/oresource.h>
static QList<Helicopter> all;
Helicopter::Helicopter(QCanvas* canvas) :
QCanvasSprite(0, canvas),
chikachika("aland01")
{
all.append(this);
hits = 0;
QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray();
- QString h0 = Resource::findPixmap("parashoot/helicopter0001");
+ QString h0 = Opie::Core::OResource::findPixmap("parashoot/helicopter0001");
h0.replace(QRegExp("0001"),"%1");
helicopterarray->readPixmaps(h0,4 );
setSequence(helicopterarray);
setAnimated(true);
move(canvas->width(), 5);
setVelocity(-2, 0);
chikachika.playLoop();
show();
}
Helicopter::~Helicopter()
{
all.remove(this);
}
int fr = 0;
void Helicopter::advance(int phase)
{
QCanvasSprite::advance(phase);
if (phase == 0) {
if (frame() == 3) {
delete this;
diff --git a/noncore/games/parashoot/interface.cpp b/noncore/games/parashoot/interface.cpp
index 5c9b0ef..8ec7032 100644
--- a/noncore/games/parashoot/interface.cpp
+++ b/noncore/games/parashoot/interface.cpp
@@ -1,106 +1,108 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "interface.h"
#include "man.h"
+#include <opie2/oresource.h>
+
#include <qtopia/qpeapplication.h>
-#include <qtopia/resource.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent,name,f),
canvas( 232, 258 ),
cannon(NULL),
base(NULL),
gamestopped( true ),
waitover( false ),
fanfare("level_up"),
score(0)
{
QPEApplication::grabKeyboard();
QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
updatespeed = 80;
canvas.setAdvancePeriod(80);
pb = new QCanvasView(&canvas, this);
pb->setFocus();
setToolBarsMovable( FALSE );
QToolBar* toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( TRUE );
setCaption( tr("ParaShoot") );
- new QToolButton( Resource::loadIconSet("new"), tr("New Game"), 0,
- this, SLOT(newGame()), toolbar, "New Game");
+ QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
+ tr("New Game"), 0, this, SLOT(newGame()), toolbar, "New Game");
+ btn->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
levelscore = new QLabel(toolbar);
levelscore->setBackgroundMode( PaletteButton );
levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs );
toolbar->setStretchableWidget( levelscore );
showScore(0,0);
setCentralWidget(pb);
autoDropTimer = new QTimer(this);
connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) );
pauseTimer = new QTimer(this);
connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
setFocusPolicy(StrongFocus);
}
void ParaShoot::resizeEvent(QResizeEvent *)
{
QSize s = centralWidget()->size();
int fw = style().defaultFrameWidth();
canvas.resize( s.width() - fw - 2, s.height() - fw - 2);
- QImage bgimage = Resource::loadImage("parashoot/sky");
+ QImage bgimage = Opie::Core::OResource::loadImage("parashoot/sky");
QPixmap bgpixmap;
bgpixmap.convertFromImage(bgimage.smoothScale(canvas.width(),
canvas.height()), QPixmap::Auto);
canvas.setBackgroundPixmap(bgpixmap);
if (base) {
base->reposition();
}
if (cannon) {
cannon->reposition();
}
}
void ParaShoot::focusOutEvent (QFocusEvent *)
{
if (!gamestopped)
canvas.setAdvancePeriod(-1);
}
void ParaShoot::focusInEvent (QFocusEvent *)
{
if (!gamestopped)
diff --git a/noncore/games/parashoot/man.cpp b/noncore/games/parashoot/man.cpp
index 0a151b0..080615e 100644
--- a/noncore/games/parashoot/man.cpp
+++ b/noncore/games/parashoot/man.cpp
@@ -1,74 +1,73 @@
/**********************************************************************
** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
** This file is part of the 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 "codes.h"
#include "man.h"
#include "base.h"
-#include <qtopia/resource.h>
-
+#include <opie2/oresource.h>
int mancount;
Man::Man(QCanvas* canvas) :
QCanvasSprite(0, canvas),
splat("lose") // No tr
{
manarray = new QCanvasPixmapArray();
- QString m0 = Resource::findPixmap("parashoot/man0001");
+ QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001");
m0.replace(QRegExp("0001"),"%1");
manarray->readPixmaps(m0, 7);
setSequence(manarray);
setAnimated(true);
mancount++;
dead = false;
start();
}
Man::Man(QCanvas* canvas, int x, int y) :
QCanvasSprite(0, canvas),
splat("bang") // No tr
{
manarray = new QCanvasPixmapArray();
- QString m0 = Resource::findPixmap("parashoot/man0001");
+ QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001");
m0.replace(QString("0001"),"%1");
manarray->readPixmaps(m0, 7);
setSequence(manarray);
move(x, y);
setFrame(5);
setZ(300);
show();
static bool first_time = TRUE;
if (first_time) {
first_time = FALSE;
QTime midnight(0, 0, 0);
srand(midnight.secsTo(QTime::currentTime()) );
}
int yfallspeed = 0;
yfallspeed = (rand() % 3) + 1;
setVelocity(0, yfallspeed);
mancount++;
dead = false;
}
int f = 0;
void Man::advance(int phase)
diff --git a/noncore/games/solitaire/canvascard.cpp b/noncore/games/solitaire/canvascard.cpp
index c36da6c..cd298ef 100644
--- a/noncore/games/solitaire/canvascard.cpp
+++ b/noncore/games/solitaire/canvascard.cpp
@@ -1,47 +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 "canvascard.h"
-#include <qpe/resource.h>
+#include <opie2/oresource.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++)
@@ -78,141 +78,136 @@ QPixmap *CreateScaledPixmap(QPixmap *srcPixmap, double scaleX, double scaleY)
}
return dstPixmap;
#else
QWMatrix s;
s.scale( scaleX, scaleY );
return new QPixmap( srcPixmap->xForm( s ) );
#endif
}
// Initialise static member variables to NULL
QPixmap *CanvasCard::cardsFaces = NULL;
QPixmap *CanvasCard::cardsBacks = NULL;
QBitmap *CanvasCard::cardsChars = NULL;
QBitmap *CanvasCard::cardsSuits = NULL;
QBitmap *CanvasCard::cardsCharsUpsideDown = NULL;
QBitmap *CanvasCard::cardsSuitsUpsideDown = NULL;
CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) :
Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0)
{
if ( !cardsFaces ) {
if ( qt_screen->deviceWidth() < 200 ) {
- cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) );
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) );
- cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) );
- cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) );
+ cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face_small" ) );
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) );
+ cardsChars = new QBitmap();
+ *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars_small" );
+ cardsSuits = new QBitmap();
+ *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits_small" );
} else {
- cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) );
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) );
- cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) );
- cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) );
+ cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face" ) );
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) );
+ cardsChars = new QBitmap();
+ *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars" );
+ cardsSuits = new QBitmap();
+ *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits" );
}
cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars );
cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits );
}
xOff = cardsFaces->width() / 2;
yOff = cardsFaces->height() / 2;
setSize( cardsFaces->width(), cardsFaces->height() );
setPen( NoPen );
flipping = FALSE;
}
void CanvasCard::setCardBack(int b)
{
if ( cardBack != b ) {
cardBack = b;
if ( cardsBacks )
delete cardsBacks;
if ( qt_screen->deviceWidth() < 200 ) {
switch (cardBack) {
case 0:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) ); break;
case 1:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002_small" ) ); break;
case 2:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003_small" ) ); break;
case 3:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004_small" ) ); break;
case 4:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005_small" ) ); break;
}
} else {
switch (cardBack) {
case 0:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) ); break;
case 1:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002" ) ); break;
case 2:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003" ) ); break;
case 3:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004" ) ); break;
case 4:
- cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break;
+ cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005" ) ); break;
}
}
if ( !isFacing() )
redraw();
}
}
void CanvasCard::draw(QPainter &painter)
{
int ix = (int)x(), iy = (int)y();
QPainter *p = &painter;
QPixmap *unscaledCard = NULL;
if ((scaleX <= 0.98) || (scaleY <= 0.98))
{
p = new QPainter();
unscaledCard = new QPixmap( cardsFaces->width(), cardsFaces->height() );
p->begin(unscaledCard);
ix = 0;
iy = 0;
}
if ( isFacing() ) {
-/*
- // Now add the joker and card backs to the list of pixmaps
- QPixmap *CardsBack = new QPixmap( Resource::loadPixmap( "cards/card_joker.png" ) );
- QPoint *newBackHotspot = new QPoint( 0, 0 );
- pixmaps->append((const QPixmap *)CardsBack);
- hotspots->append((const QPoint *)newBackHotspot);
-*/
-
int w = cardsFaces->width(), h = cardsFaces->height();
-// p->setBrush( NoBrush );
p->setBrush( QColor( 0xFF, 0xFF, 0xFF ) );
if ( isRed() == TRUE )
p->setPen( QColor( 0xFF, 0, 0 ) );
else
p->setPen( QColor( 0, 0, 0 ) );
if ( qt_screen->deviceWidth() < 200 ) {
p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 );
p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 );
p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 );
p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 );
} else {
p->drawPixmap( ix + 0, iy + 0, *cardsFaces );
p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 );
p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 );
p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 );
p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 );
}
} else {
p->drawPixmap( ix, iy, *cardsBacks );
diff --git a/noncore/games/solitaire/canvascardgame.h b/noncore/games/solitaire/canvascardgame.h
index b93cfbf..c559a90 100644
--- a/noncore/games/solitaire/canvascardgame.h
+++ b/noncore/games/solitaire/canvascardgame.h
@@ -3,49 +3,48 @@
**
** 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.
**
**********************************************************************/
#ifndef CANVAS_CARD_GAME_H
#define CANVAS_CARD_GAME_H
#include "cardgame.h"
#include "canvasshapes.h"
#include "canvascard.h"
-#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmainwindow.h>
#include <qmenubar.h>
#include <qpainter.h>
#include <stdlib.h>
#include <time.h>
class CanvasCardPile;
class CanvasCardGame : public QCanvasView, public CardGame
{
public:
CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) :
QCanvasView( &c, parent, name, f ),
CardGame(0,numOfDecks),
moved(FALSE),
moving(NULL),
alphaCardPile( NULL ),
cardXOff(0), cardYOff(0),
snapOn(snap),
diff --git a/noncore/games/solitaire/canvascardwindow.cpp b/noncore/games/solitaire/canvascardwindow.cpp
index 503bc92..956c5bd 100644
--- a/noncore/games/solitaire/canvascardwindow.cpp
+++ b/noncore/games/solitaire/canvascardwindow.cpp
@@ -3,66 +3,65 @@
**
** 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 "freecellcardgame.h"
#include "chicanecardgame.h"
#include "harpcardgame.h"
#include "teeclubcardgame.h"
-
-
+#include <opie2/oresource.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" ) );
+ setIcon( Opie::Core::OResource::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 );
+ bg.convertFromImage( Opie::Core::OResource::loadImage( "table_pattern" ), ThresholdDither );
canvas.setBackgroundPixmap(bg);
}
#if defined( QT_QWS_CASSIOPEIA )
canvas.setAdvancePeriod(70);
#else
canvas.setAdvancePeriod(30);
#endif
#ifdef _PATIENCE_USE_ACCELS_
QMenuBar* menu = menuBar();
QPopupMenu* file = new QPopupMenu;
file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F);
file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F);
file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F);
file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F);
file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F);
menu->insertItem(tr("&Game"), file);
menu->insertSeparator();
settings = new QPopupMenu;
diff --git a/noncore/games/tetrix/qtetrix.cpp b/noncore/games/tetrix/qtetrix.cpp
index a6a5f34..d949176 100644
--- a/noncore/games/tetrix/qtetrix.cpp
+++ b/noncore/games/tetrix/qtetrix.cpp
@@ -1,48 +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 "qtetrix.h"
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include <qlabel.h>
#include <qdatetime.h>
#include <qlayout.h>
#include <qtimer.h>
#include "ohighscoredlg.h"
void drawTetrixButton( QPainter *p, int x, int y, int w, int h,
const QColor *color )
{
QColor fc;
if ( color ) {
QPointArray a;
a.setPoints( 3, x,y+h-1, x,y, x+w-1,y );
p->setPen( color->light() );
p->drawPolyline( a );
a.setPoints( 3, x+1,y+h-1, x+w-1,y+h-1, x+w-1,y+1 );
p->setPen( color->dark() );
p->drawPolyline( a );
x++;
y++;
w -= 2;
@@ -76,49 +76,49 @@ void ShowNextPiece::paintEvent( QPaintEvent * )
{
QPainter p( this );
drawFrame( &p );
p.end(); // explicit end() so any slots can paint too
emit update();
}
void ShowNextPiece::drawNextSquare(int x, int y,QColor *color)
{
if (xOffset == -1) // Before first resizeEvent?
return;
QPainter paint;
paint.begin(this);
drawTetrixButton( &paint, xOffset+x*blockWidth, yOffset+y*blockHeight,
blockWidth, blockHeight, color );
paint.end();
}
QTetrix::QTetrix( QWidget *parent, const char *name, WFlags f )
: QMainWindow( parent, name, f )
{
- setIcon( Resource::loadPixmap( "tetrix_icon" ) );
+ setIcon( Opie::Core::OResource::loadPixmap( "tetrix_icon" ) );
setCaption( tr("Tetrix" ) );
QTime t = QTime::currentTime();
TetrixPiece::setRandomSeed( (((double)t.hour())+t.minute()+t.second())/
(24+60+60) );
QWidget *gameArea = new QWidget( this );
setCentralWidget( gameArea );
QGridLayout *gl = new QGridLayout( gameArea, 5, 3, 8 );
gl->setColStretch( 1, 5 );
gl->setColStretch( 2, 10 );
QLabel *l;
l = new QLabel( tr("Next"), gameArea );
gl->addWidget( l, 0, 0 );
showNext = new ShowNextPiece(gameArea);
showNext->setBackgroundColor(QColor(0,0,0));
gl->addWidget( showNext, 0, 1 );
l = new QLabel( tr("Score"), gameArea );
gl->addWidget( l, 1, 0 );
showScore = new QLabel(gameArea);
gl->addWidget( showScore, 1, 1 );
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index 47d6725..52e2be2 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -1,49 +1,50 @@
/**********************************************************************
** 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 "wordgame.h"
+#include <opie2/oresource.h>
+
#include <qpe/global.h>
-#include <qpe/resource.h>
#include <qpe/config.h>
#include <qapplication.h>
#include <qmessagebox.h>
#include <qcombobox.h>
#include <qdir.h>
#include <qlineedit.h>
#include <qpushbutton.h>
#include <qtextstream.h>
#include <qtimer.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qvbox.h>
#include <qwidgetstack.h>
#include <qlayout.h>
#include <stdlib.h>
#include <unistd.h>
#include <pwd.h>
#include <sys/types.h>
enum RuleEffects {
Multiplier=15,
MultiplyAll=64,
@@ -97,62 +98,69 @@ const char* sampleWGR=
"4 c 2\n"
"5 l 1\n"
"5 o 1\n"
"7 t 1\n"
"7 n 1\n"
"7 a 1\n"
"7 r 1\n"
"8 s 1\n"
"8 i 1\n"
"11 e 1\n"
"0\n";
WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) :
QMainWindow(parent, name, fl)
{
if ( qApp->desktop()->width() < 240 ) {
tile_smallw = 10;
tile_smallh = 10;
tile_bigw = 16;
tile_bigh = 16;
tile_stweak = 0;
tile_btweak = 0;
}
- setIcon( Resource::loadPixmap( "wordgame/WordGame.png" ) );
+ setIcon( Opie::Core::OResource::loadPixmap( "wordgame/WordGame" ) );
setCaption( tr("Word Game") );
setToolBarsMovable( FALSE );
vbox = new QVBox(this);
setCentralWidget(vbox);
toolbar = new QToolBar(this);
addToolBar(toolbar, Bottom);
- reset = new QToolButton(Resource::loadPixmap("back"), tr("Back"), "", this, SLOT(resetTurn()), toolbar);
- done = new QToolButton(Resource::loadPixmap("done"), tr("Done"), "", this, SLOT(endTurn()), toolbar);
+ bool useBigIcon = qApp->desktop()->size().width() > 330;
+ reset = new QToolButton(Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon),
+ tr("Back"), "", this, SLOT(resetTurn()), toolbar);
+ reset->setUsesBigPixmap( useBigIcon );
+ done = new QToolButton(Opie::Core::OResource::loadPixmap("done", Opie::Core::OResource::SmallIcon),
+ tr("Done"), "", this, SLOT(endTurn()), toolbar);
+ done->setUsesBigPixmap( useBigIcon );
scoreinfo = new ScoreInfo(toolbar);
scoreinfo->setFont(QFont("Helvetica",10));
- new QToolButton(Resource::loadPixmap("finish"), tr("Close"), "", this, SLOT(endGame()), toolbar);
+ QToolButton *btn = new QToolButton(Opie::Core::OResource::loadPixmap("finish", Opie::Core::OResource::SmallIcon),
+ tr("Close"), "", this, SLOT(endGame()), toolbar);
+ btn->setUsesBigPixmap( useBigIcon );
toolbar->setStretchableWidget(scoreinfo);
cpu = 0;
board = 0;
bag = 0;
racks = 0;
aiheart = new QTimer(this);
connect(aiheart, SIGNAL(timeout()), this, SLOT(think()));
readConfig();
}
WordGame::~WordGame()
{
writeConfig();
}
void WordGame::writeConfig()
{
Config cfg("WordGame");
cfg.setGroup("Game");
cfg.writeEntry("NameList",namelist,';');
cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1);
@@ -284,49 +292,49 @@ bool WordGame::loadRules(const QString &name)
//setCaption( title );
QString shapepixmap;
ts >> shapepixmap;
int htiles,vtiles;
ts >> htiles >> vtiles;
if ( htiles < 3 || vtiles < 3 )
return FALSE;
QString rule_shapes;
for (int i=0; i<vtiles; i++) {
QString line;
ts >> line;
rule_shapes += line;
}
static int rule_effects[12];
int re=0,e;
ts >> e;
while ( e && re < 10 ) {
rule_effects[re] = e;
if ( re++ < 10 ) ts >> e;
}
- QImage shim = Resource::loadImage("wordgame/wordgame_shapes");
+ QImage shim = Opie::Core::OResource::loadImage("wordgame/wordgame_shapes");
shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight());
QPixmap bgshapes;
bgshapes.convertFromImage(shim);
rule_effects[re++] = 100; // default bonus
board = new Board(bgshapes, htiles, vtiles, vbox);
board->setRules(rule_shapes, rule_effects);
connect(board, SIGNAL(temporaryScore(int)), scoreinfo, SLOT(showTemporaryScore(int)));
bag = new Bag;
int count;
ts >> count;
while ( count ) {
QString text;
int value;
ts >> text >> value;
if ( text == "_" )
text = "";
Tile t(text, value);
for (int n=count; n--; )
bag->add(t);
@@ -1341,49 +1349,49 @@ void Rack::contentsMousePressEvent(QMouseEvent* e)
return;
QCanvasItemList list = canvas()->collisions(e->pos());
if (list.count()) {
dragging = list.first();
dragstart = e->pos()-QPoint(int(dragging->x()),int(dragging->y()));
} else {
dragging = 0;
}
}
void Rack::contentsMouseMoveEvent(QMouseEvent* e)
{
if ( computerized() )
return;
//int w = TileItem::bigWidth()+2;
if ( dragging ) {
dragging_adj = TileItem::bigWidth()/2;
if ( dragging->x() > e->x()-dragstart.x() )
dragging_adj = -dragging_adj;
dragging->move(e->x()-dragstart.x(),0);
layoutTiles();
}
}
-void Rack::contentsMouseReleaseEvent(QMouseEvent* e)
+void Rack::contentsMouseReleaseEvent(QMouseEvent* /*e*/)
{
if ( computerized() )
return;
if ( dragging ) {
dragging=0;
layoutTiles();
}
}
Tile::Tile(const QString& key)
{
int a=key.find('@');
txt = key.left(a);
val = key.mid(a+1).toInt();
blank = txt.isEmpty();
}
QString Tile::key() const
{
return txt+"@"+QString::number(val);
}
Bag::Bag()
{
diff --git a/noncore/games/zlines/ballpainter.cpp b/noncore/games/zlines/ballpainter.cpp
index 622ec29..e7596c4 100644
--- a/noncore/games/zlines/ballpainter.cpp
+++ b/noncore/games/zlines/ballpainter.cpp
@@ -1,86 +1,86 @@
/***************************************************************************
ballpainter.cpp - description
-------------------
begin : Fri May 19 2000
copyright : (C) 2000 by Roman Merzlyakov
email : roman@sbrf.barrt.ru
copyright : (C) 2000 by Roman Razilov
email : Roman.Razilov@gmx.de
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
-#include <qpe/resource.h>
+#include <opie2/oresource.h>
#include "ballpainter.h"
//#include "shotcounter.h"
#include <qpainter.h>
//#include <qcolor.h>
#define PIXSIZE 21
int colorLinesArr[NCOLORS] =
{0x0000ff, 0x00ff00, 0xff0000, 0x00ffff, 0xff00ff, 0xffff00, 0x005080};
// 0x00bbggrr
// red , green , blue , yellow , violet , cyan , brown
BallPainter::BallPainter()
: QObject()
{
createPixmap();
}
BallPainter::~BallPainter()
{
}
QPixmap* BallPainter::pixmap( enum Pixmaps pix )
{
QString name;
switch(pix) {
case Field:
name = QString::fromLatin1("zlines/field");
break;
case Balls:
name = QString::fromLatin1("zlines/balls");
break;
case Fire:
name = QString::fromLatin1("zlines/fire");
break;
}
- return new QPixmap(Resource::loadPixmap(name) );
+ return new QPixmap(Opie::Core::OResource::loadPixmap(name) );
}
void BallPainter::createPixmap()
{
// warning( kapp->kde_datadir() +"/klines/data/balls.bmp");
backgroundPix = pixmap(Field);
QPixmap *balls = pixmap(Balls);
QPixmap *fire = pixmap(Fire);
if (balls->isNull() ||backgroundPix->isNull() || fire->isNull() )
fatal("Cannot open data files.\nHave you correctly installed klines?");
warning("Pixsize %i", PIXSIZE);
for(int c=0; c<NCOLORS; c++)
{
for(int t=0; t<PIXTIME + FIREBALLS + BOOMBALLS + 1 ; t++)
{
imgCash[c][t] = new QPixmap(CELLSIZE, CELLSIZE);
QPainter p(imgCash[c][t]);
p.drawPixmap(0,0,(*backgroundPix),0,0,CELLSIZE,CELLSIZE);
p.drawPixmap(1,1,(*balls),t*PIXSIZE,c*PIXSIZE,PIXSIZE,PIXSIZE);
}
for(int t=0; t < FIREPIX ; t++)
{
firePix[t] = new QPixmap(CELLSIZE, CELLSIZE);