summaryrefslogtreecommitdiff
path: root/noncore/games/mindbreaker/mindbreaker.cpp
authordrw <drw>2005-05-21 20:11:55 (UTC)
committer drw <drw>2005-05-21 20:11:55 (UTC)
commitafb929e7fd04ecdfec2799a5cf9cf298d1af77c6 (patch) (unidiff)
tree5db439fca569cf1349220f3fbbf155405d13a80d /noncore/games/mindbreaker/mindbreaker.cpp
parentd56ca82c22c3ac6b7dfb0bb7b4d5a0e5ad1ff4f1 (diff)
downloadopie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.zip
opie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.tar.gz
opie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.tar.bz2
Resource -> OResource
Diffstat (limited to 'noncore/games/mindbreaker/mindbreaker.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/mindbreaker/mindbreaker.cpp13
1 files changed, 7 insertions, 6 deletions
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
@@ -11,25 +11,26 @@
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "mindbreaker.h" 21#include "mindbreaker.h"
22 22
23#include <qtopia/resource.h> 23#include <opie2/oresource.h>
24
24#include <qtopia/config.h> 25#include <qtopia/config.h>
25#include <qtopia/qpeapplication.h> 26#include <qtopia/qpeapplication.h>
26#include <qtoolbar.h> 27#include <qtoolbar.h>
27 28
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29#include <qmessagebox.h> 30#include <qmessagebox.h>
30#include <qlayout.h> 31#include <qlayout.h>
31#include <qtimer.h> 32#include <qtimer.h>
32 33
33#include <stdlib.h> 34#include <stdlib.h>
34#include <sys/time.h> 35#include <sys/time.h>
35#include <unistd.h> 36#include <unistd.h>
@@ -130,43 +131,43 @@ private:
130 int pegtype; 131 int pegtype;
131 int peg_go; 132 int peg_go;
132 int peg_pos; 133 int peg_pos;
133 134
134 int aniStep; 135 int aniStep;
135}; 136};
136int Peg::eggLevel = 0; 137int Peg::eggLevel = 0;
137QVector<QImage> Peg::normalPegs; 138QVector<QImage> Peg::normalPegs;
138QVector<QImage> Peg::specialPegs; 139QVector<QImage> Peg::specialPegs;
139 140
140void Peg::buildImages() 141void Peg::buildImages()
141{ 142{
142 QImage pegs = Resource::loadImage("mindbreaker/pegs"); 143 QImage pegs = Opie::Core::OResource::loadImage("mindbreaker/pegs");
143 int x = 0; 144 int x = 0;
144 int y = 0; 145 int y = 0;
145 int i; 146 int i;
146 eggLevel = 0; 147 eggLevel = 0;
147 normalPegs.resize(10); 148 normalPegs.resize(10);
148 for (i = 0; i < 6; i++) { 149 for (i = 0; i < 6; i++) {
149 normalPegs.insert(i, new QImage(pegs.copy(x, y, peg_size, peg_size). 150 normalPegs.insert(i, new QImage(pegs.copy(x, y, peg_size, peg_size).
150 smoothScale(adjusted_peg_size, adjusted_peg_size) )); 151 smoothScale(adjusted_peg_size, adjusted_peg_size) ));
151 x += peg_size; 152 x += peg_size;
152 } 153 }
153 specialPegs.resize(5); 154 specialPegs.resize(5);
154 for (i = 0; i < 5; i++) { 155 for (i = 0; i < 5; i++) {
155 specialPegs.insert(i, new QImage(pegs.copy(x,y,peg_size, peg_size). 156 specialPegs.insert(i, new QImage(pegs.copy(x,y,peg_size, peg_size).
156 smoothScale(adjusted_peg_size, adjusted_peg_size) )); 157 smoothScale(adjusted_peg_size, adjusted_peg_size) ));
157 x += peg_size; 158 x += peg_size;
158 } 159 }
159 160
160 QImage image = Resource::loadImage("mindbreaker/mindbreaker"); 161 QImage image = Opie::Core::OResource::loadImage("mindbreaker/mindbreaker");
161 /* copy from master image to functional images */ 162 /* copy from master image to functional images */
162 x = 0; 163 x = 0;
163 y = panel_height; 164 y = panel_height;
164 normalPegs.insert(8, 165 normalPegs.insert(8,
165 new QImage( image.copy(x, y, panel_width, panel_height). 166 new QImage( image.copy(x, y, panel_width, panel_height).
166 smoothScale( adjusted_panel_width, adjusted_panel_height) 167 smoothScale( adjusted_panel_width, adjusted_panel_height)
167 )); 168 ));
168 y += panel_height; 169 y += panel_height;
169 y += title_height; 170 y += title_height;
170 normalPegs.insert(9, 171 normalPegs.insert(9,
171 new QImage(image.copy(x, y, title_width, title_height). 172 new QImage(image.copy(x, y, title_width, title_height).
172 smoothScale( adjusted_title_width, adjusted_title_height) 173 smoothScale( adjusted_title_width, adjusted_title_height)
@@ -280,27 +281,27 @@ MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags )
280 hb->addStretch(); 281 hb->addStretch();
281 board = new MindBreakerBoard(w); 282 board = new MindBreakerBoard(w);
282 hb->addWidget( board, 100 ); 283 hb->addWidget( board, 100 );
283 hb->addStretch(); 284 hb->addStretch();
284 285
285 setCentralWidget(w); 286 setCentralWidget(w);
286 287
287 setToolBarsMovable( FALSE ); 288 setToolBarsMovable( FALSE );
288 289
289 QToolBar *tb = new QToolBar(this); 290 QToolBar *tb = new QToolBar(this);
290 tb->setHorizontalStretchable( TRUE ); 291 tb->setHorizontalStretchable( TRUE );
291 292
292 QIconSet newicon = Resource::loadIconSet("new"); 293 QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), tr("New Game"), 0,
293 new QToolButton(newicon, tr("New Game"), 0,
294 board, SLOT(clear()), tb, "NewGame"); 294 board, SLOT(clear()), tb, "NewGame");
295 btn->setUsesBigPixmap( qApp->desktop()->size().width() > 330 );
295 296
296 score = new QToolButton(tb); 297 score = new QToolButton(tb);
297 score->setText(""); 298 score->setText("");
298 score->setMaximumHeight(20); 299 score->setMaximumHeight(20);
299 score->setUsesTextLabel(TRUE); 300 score->setUsesTextLabel(TRUE);
300 tb->setStretchableWidget(score); 301 tb->setStretchableWidget(score);
301 302
302 connect(board, SIGNAL(scoreChanged(int,int)), this, SLOT(setScore(int,int))); 303 connect(board, SIGNAL(scoreChanged(int,int)), this, SLOT(setScore(int,int)));
303 connect(score, SIGNAL(clicked()), board, SLOT(resetScore())); 304 connect(score, SIGNAL(clicked()), board, SLOT(resetScore()));
304 305
305 int a, b; 306 int a, b;
306 board->getScore(&a, &b); 307 board->getScore(&a, &b);
@@ -474,25 +475,25 @@ void MindBreakerBoard::doFixSize()
474 475
475 if (s.height() < adjusted_board_height) 476 if (s.height() < adjusted_board_height)
476 s.setHeight(adjusted_board_height); 477 s.setHeight(adjusted_board_height);
477*/ 478*/
478 479
479 if ( current_highlight ) // non-first resize 480 if ( current_highlight ) // non-first resize
480 writeConfig(); 481 writeConfig();
481 482
482 setupBoardSize(s.width() - fw, s.height() - fw); 483 setupBoardSize(s.width() - fw, s.height() - fw);
483 canvas()->resize(s.width() - fw, s.height() - fw); 484 canvas()->resize(s.width() - fw, s.height() - fw);
484 Peg::buildImages(); // must be done BEFORE any pegs are made 485 Peg::buildImages(); // must be done BEFORE any pegs are made
485 486
486 QImage image = Resource::loadImage("mindbreaker/mindbreaker"); 487 QImage image = Opie::Core::OResource::loadImage("mindbreaker/mindbreaker");
487 488
488 /* copy from master image to functional images */ 489 /* copy from master image to functional images */
489 int x = 0; 490 int x = 0;
490 int y = 0; 491 int y = 0;
491 panelImage = image.copy(x, y, panel_width, panel_height). 492 panelImage = image.copy(x, y, panel_width, panel_height).
492 smoothScale( adjusted_panel_width, adjusted_panel_height); 493 smoothScale( adjusted_panel_width, adjusted_panel_height);
493 494
494 y += panel_height; 495 y += panel_height;
495 y += panel_height; 496 y += panel_height;
496 497
497 titleImage = image.copy(x, y, title_width, title_height). 498 titleImage = image.copy(x, y, title_width, title_height).
498 smoothScale( adjusted_title_width, adjusted_title_height); 499 smoothScale( adjusted_title_width, adjusted_title_height);