author | drw <drw> | 2005-05-21 20:11:55 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-21 20:11:55 (UTC) |
commit | afb929e7fd04ecdfec2799a5cf9cf298d1af77c6 (patch) (unidiff) | |
tree | 5db439fca569cf1349220f3fbbf155405d13a80d | |
parent | d56ca82c22c3ac6b7dfb0bb7b4d5a0e5ad1ff4f1 (diff) | |
download | opie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.zip opie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.tar.gz opie-afb929e7fd04ecdfec2799a5cf9cf298d1af77c6.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 34 | ||||
-rw-r--r-- | noncore/games/fifteen/fifteen.cpp | 16 | ||||
-rw-r--r-- | noncore/games/mindbreaker/config.in | 2 | ||||
-rw-r--r-- | noncore/games/mindbreaker/mindbreaker.cpp | 15 | ||||
-rw-r--r-- | noncore/games/mindbreaker/opie-mindbreaker.control | 2 | ||||
-rw-r--r-- | noncore/games/minesweep/minesweep.cpp | 5 | ||||
-rw-r--r-- | noncore/games/parashoot/base.cpp | 5 | ||||
-rw-r--r-- | noncore/games/parashoot/bullet.cpp | 5 | ||||
-rw-r--r-- | noncore/games/parashoot/cannon.cpp | 5 | ||||
-rw-r--r-- | noncore/games/parashoot/helicopter.cpp | 4 | ||||
-rw-r--r-- | noncore/games/parashoot/interface.cpp | 10 | ||||
-rw-r--r-- | noncore/games/parashoot/man.cpp | 7 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascard.cpp | 51 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascardgame.h | 1 | ||||
-rw-r--r-- | noncore/games/solitaire/canvascardwindow.cpp | 7 | ||||
-rw-r--r-- | noncore/games/tetrix/qtetrix.cpp | 4 | ||||
-rw-r--r-- | noncore/games/wordgame/wordgame.cpp | 22 | ||||
-rw-r--r-- | noncore/games/zlines/ballpainter.cpp | 4 |
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,62 +1,62 @@ | |||
1 | #include "backgammon.h" | 1 | #include "backgammon.h" |
2 | #include "aidialog.h" | 2 | #include "aidialog.h" |
3 | #include "filedialog.h" | 3 | #include "filedialog.h" |
4 | #include "playerdialog.h" | 4 | #include "playerdialog.h" |
5 | #include "rulesdialog.h" | 5 | #include "rulesdialog.h" |
6 | #include "themedialog.h" | 6 | #include "themedialog.h" |
7 | 7 | ||
8 | /* OPIE */ | 8 | /* OPIE */ |
9 | #include <opie2/odebug.h> | 9 | #include <opie2/odebug.h> |
10 | #include <opie2/oresource.h> | ||
10 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
11 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
12 | #include <qpe/resource.h> | ||
13 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
14 | 14 | ||
15 | /* QT */ | 15 | /* QT */ |
16 | #include <qfile.h> | 16 | #include <qfile.h> |
17 | #include <qlayout.h> | 17 | #include <qlayout.h> |
18 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
19 | #include <qtimer.h> | 19 | #include <qtimer.h> |
20 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
21 | 21 | ||
22 | #include <stdlib.h> | 22 | #include <stdlib.h> |
23 | 23 | ||
24 | 24 | ||
25 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | 25 | BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) |
26 | : QMainWindow(parent, name, fl) | 26 | : QMainWindow(parent, name, fl) |
27 | { | 27 | { |
28 | if (!name) setName("BackGammon"); | 28 | if (!name) setName("BackGammon"); |
29 | setCaption(tr( "Backgammon") ); | 29 | setCaption(tr( "Backgammon") ); |
30 | setIcon( Resource::loadPixmap( "backgammon" ) ); | 30 | setIcon( Opie::Core::OResource::loadPixmap( "backgammon" ) ); |
31 | //general counter varaible | 31 | //general counter varaible |
32 | int a=0; | 32 | int a=0; |
33 | //the game engine | 33 | //the game engine |
34 | move=new MoveEngine(); | 34 | move=new MoveEngine(); |
35 | 35 | ||
36 | //load the default theme | 36 | //load the default theme |
37 | Config conf("backgammon"); | 37 | Config conf("backgammon"); |
38 | if(!conf.isValid()) | 38 | if(!conf.isValid()) |
39 | { | 39 | { |
40 | odebug << "config file does not exist" << oendl; | 40 | odebug << "config file does not exist" << oendl; |
41 | conf.setGroup("general"); | 41 | conf.setGroup("general"); |
42 | conf.writeEntry("theme","default"); | 42 | conf.writeEntry("theme","default"); |
43 | conf.setGroup("rules"); | 43 | conf.setGroup("rules"); |
44 | conf.writeEntry("move_with_pieces_out",false); | 44 | conf.writeEntry("move_with_pieces_out",false); |
45 | conf.writeEntry("nice_dice",false); | 45 | conf.writeEntry("nice_dice",false); |
46 | conf.setGroup("display"); | 46 | conf.setGroup("display"); |
47 | conf.writeEntry("small",false); | 47 | conf.writeEntry("small",false); |
48 | conf.writeEntry("warning",true); | 48 | conf.writeEntry("warning",true); |
49 | conf.setGroup("ai"); | 49 | conf.setGroup("ai"); |
50 | conf.writeEntry("rescue",6); | 50 | conf.writeEntry("rescue",6); |
51 | conf.writeEntry("eliminate",4); | 51 | conf.writeEntry("eliminate",4); |
52 | conf.writeEntry("expose",1); | 52 | conf.writeEntry("expose",1); |
53 | conf.writeEntry("protect",5); | 53 | conf.writeEntry("protect",5); |
54 | conf.writeEntry("safe",3); | 54 | conf.writeEntry("safe",3); |
55 | conf.writeEntry("empty",2); | 55 | conf.writeEntry("empty",2); |
56 | 56 | ||
57 | } | 57 | } |
58 | conf.setGroup("general"); | 58 | conf.setGroup("general"); |
59 | theme_name=conf.readEntry("theme","default"); | 59 | theme_name=conf.readEntry("theme","default"); |
60 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; | 60 | QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme"; |
61 | 61 | ||
62 | //the rules | 62 | //the rules |
@@ -140,161 +140,161 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
140 | boardview->setMaximumHeight(240); | 140 | boardview->setMaximumHeight(240); |
141 | layout->addWidget(boardview); | 141 | layout->addWidget(boardview); |
142 | connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); | 142 | connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); |
143 | //status bar | 143 | //status bar |
144 | message=new QLabel("<b>Backgammon</b>",mainarea); | 144 | message=new QLabel("<b>Backgammon</b>",mainarea); |
145 | message->setAlignment(AlignHCenter); | 145 | message->setAlignment(AlignHCenter); |
146 | layout->addWidget(message); | 146 | layout->addWidget(message); |
147 | 147 | ||
148 | //the marker | 148 | //the marker |
149 | marker_current=new QCanvasRectangle(area); | 149 | marker_current=new QCanvasRectangle(area); |
150 | marker_current->setBrush(QColor(0,0,255)); | 150 | marker_current->setBrush(QColor(0,0,255)); |
151 | marker_current->setSize(15,5); | 151 | marker_current->setSize(15,5); |
152 | marker_current->setZ(1); | 152 | marker_current->setZ(1); |
153 | 153 | ||
154 | for(a=0;a<4;a++) | 154 | for(a=0;a<4;a++) |
155 | { | 155 | { |
156 | marker_next[a]=new QCanvasRectangle(area); | 156 | marker_next[a]=new QCanvasRectangle(area); |
157 | marker_next[a]->setBrush(QColor(0,255,0)); | 157 | marker_next[a]->setBrush(QColor(0,255,0)); |
158 | marker_next[a]->setSize(15,5); | 158 | marker_next[a]->setSize(15,5); |
159 | marker_next[a]->setZ(1); | 159 | marker_next[a]->setZ(1); |
160 | } | 160 | } |
161 | 161 | ||
162 | connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1())); | 162 | connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1())); |
163 | connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2())); | 163 | connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2())); |
164 | connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3())); | 164 | connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3())); |
165 | connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4())); | 165 | connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4())); |
166 | connect(move,SIGNAL(nomove()),this,SLOT(nomove())); | 166 | connect(move,SIGNAL(nomove()),this,SLOT(nomove())); |
167 | connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int))); | 167 | connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int))); |
168 | 168 | ||
169 | //the pieces | 169 | //the pieces |
170 | p1=new CanvasImageItem*[15]; | 170 | p1=new CanvasImageItem*[15]; |
171 | p1_side=new CanvasImageItem*[15]; | 171 | p1_side=new CanvasImageItem*[15]; |
172 | QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name)); | 172 | QImage piece_1_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesA_name)); |
173 | QImage piece_1_front=piece_1_all.copy(0,0,15,15); | 173 | QImage piece_1_front=piece_1_all.copy(0,0,15,15); |
174 | QImage piece_1_side=piece_1_all.copy(0,15,15,5); | 174 | QImage piece_1_side=piece_1_all.copy(0,15,15,5); |
175 | 175 | ||
176 | p2=new CanvasImageItem*[15]; | 176 | p2=new CanvasImageItem*[15]; |
177 | p2_side=new CanvasImageItem*[15]; | 177 | p2_side=new CanvasImageItem*[15]; |
178 | QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name)); | 178 | QImage piece_2_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesB_name)); |
179 | QImage piece_2_front=piece_2_all.copy(0,0,15,15); | 179 | QImage piece_2_front=piece_2_all.copy(0,0,15,15); |
180 | QImage piece_2_side=piece_2_all.copy(0,15,15,5); | 180 | QImage piece_2_side=piece_2_all.copy(0,15,15,5); |
181 | 181 | ||
182 | 182 | ||
183 | for(a=0;a<15;a++) | 183 | for(a=0;a<15;a++) |
184 | { | 184 | { |
185 | p1[a]=new CanvasImageItem(piece_1_front,area); | 185 | p1[a]=new CanvasImageItem(piece_1_front,area); |
186 | p1[a]->setSize(15,15); | 186 | p1[a]->setSize(15,15); |
187 | p1_side[a]=new CanvasImageItem(piece_1_side,area); | 187 | p1_side[a]=new CanvasImageItem(piece_1_side,area); |
188 | p1_side[a]->setSize(15,5); | 188 | p1_side[a]->setSize(15,5); |
189 | 189 | ||
190 | p2[a]=new CanvasImageItem(piece_2_front,area); | 190 | p2[a]=new CanvasImageItem(piece_2_front,area); |
191 | p2[a]->setSize(15,15); | 191 | p2[a]->setSize(15,15); |
192 | p2_side[a]=new CanvasImageItem(piece_2_side,area); | 192 | p2_side[a]=new CanvasImageItem(piece_2_side,area); |
193 | p2_side[a]->setSize(15,5); | 193 | p2_side[a]->setSize(15,5); |
194 | } | 194 | } |
195 | draw(); | 195 | draw(); |
196 | 196 | ||
197 | //the dice | 197 | //the dice |
198 | QImage dicebgA_all(Resource::loadImage("backgammon/dice/"+diceA_name)); | 198 | QImage dicebgA_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceA_name)); |
199 | diceA1=new CanvasImageItem*[7]; | 199 | diceA1=new CanvasImageItem*[7]; |
200 | diceA2=new CanvasImageItem*[7]; | 200 | diceA2=new CanvasImageItem*[7]; |
201 | QImage dicebgB_all(Resource::loadImage("backgammon/dice/"+diceB_name)); | 201 | QImage dicebgB_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceB_name)); |
202 | diceB1=new CanvasImageItem*[7]; | 202 | diceB1=new CanvasImageItem*[7]; |
203 | diceB2=new CanvasImageItem*[7]; | 203 | diceB2=new CanvasImageItem*[7]; |
204 | QImage oddsbg_all=(Resource::loadImage("backgammon/odds/"+odds_name)); | 204 | QImage oddsbg_all=(Opie::Core::OResource::loadImage("backgammon/odds/"+odds_name)); |
205 | //oddsDice=new CanvasImageItem*[6]; | 205 | //oddsDice=new CanvasImageItem*[6]; |
206 | 206 | ||
207 | 207 | ||
208 | for(a=0;a<7;a++) | 208 | for(a=0;a<7;a++) |
209 | { | 209 | { |
210 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); | 210 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); |
211 | diceA1[a]=new CanvasImageItem(dicebgA,area); | 211 | diceA1[a]=new CanvasImageItem(dicebgA,area); |
212 | diceA1[a]->setX(5); | 212 | diceA1[a]->setX(5); |
213 | diceA1[a]->setY(205-2); | 213 | diceA1[a]->setY(205-2); |
214 | diceA1[a]->setZ(1); | 214 | diceA1[a]->setZ(1); |
215 | diceA1[a]->setSize(25,25); | 215 | diceA1[a]->setSize(25,25); |
216 | diceA2[a]=new CanvasImageItem(dicebgA,area); | 216 | diceA2[a]=new CanvasImageItem(dicebgA,area); |
217 | diceA2[a]->setX(35); | 217 | diceA2[a]->setX(35); |
218 | diceA2[a]->setY(205-2); | 218 | diceA2[a]->setY(205-2); |
219 | diceA2[a]->setZ(1); | 219 | diceA2[a]->setZ(1); |
220 | diceA2[a]->setSize(25,25); | 220 | diceA2[a]->setSize(25,25); |
221 | 221 | ||
222 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); | 222 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); |
223 | diceB1[a]=new CanvasImageItem(dicebgB,area); | 223 | diceB1[a]=new CanvasImageItem(dicebgB,area); |
224 | diceB1[a]->setX(175); | 224 | diceB1[a]->setX(175); |
225 | diceB1[a]->setY(205-2); | 225 | diceB1[a]->setY(205-2); |
226 | diceB1[a]->setZ(1); | 226 | diceB1[a]->setZ(1); |
227 | diceB1[a]->setSize(25,25); | 227 | diceB1[a]->setSize(25,25); |
228 | diceB2[a]=new CanvasImageItem(dicebgB,area); | 228 | diceB2[a]=new CanvasImageItem(dicebgB,area); |
229 | diceB2[a]->setX(205); | 229 | diceB2[a]->setX(205); |
230 | diceB2[a]->setY(205-2); | 230 | diceB2[a]->setY(205-2); |
231 | diceB2[a]->setZ(1); | 231 | diceB2[a]->setZ(1); |
232 | diceB2[a]->setSize(25,25); | 232 | diceB2[a]->setSize(25,25); |
233 | 233 | ||
234 | /* | 234 | /* |
235 | if(a<6) | 235 | if(a<6) |
236 | { | 236 | { |
237 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); | 237 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); |
238 | oddsDice[a]=new CanvasImageItem(oddsbg,area); | 238 | oddsDice[a]=new CanvasImageItem(oddsbg,area); |
239 | oddsDice[a]->setX(110); | 239 | oddsDice[a]->setX(110); |
240 | oddsDice[a]->setY(210-2); | 240 | oddsDice[a]->setY(210-2); |
241 | oddsDice[a]->setZ(1); | 241 | oddsDice[a]->setZ(1); |
242 | oddsDice[a]->setSize(15,15); | 242 | oddsDice[a]->setSize(15,15); |
243 | oddsDice[a]->hide(); | 243 | oddsDice[a]->hide(); |
244 | } | 244 | } |
245 | */ | 245 | */ |
246 | } | 246 | } |
247 | //oddsDice[0]->show(); | 247 | //oddsDice[0]->show(); |
248 | 248 | ||
249 | //set the board | 249 | //set the board |
250 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); | 250 | QImage boardbg(Opie::Core::OResource::loadImage("backgammon/boards/"+board_name)); |
251 | board=new CanvasImageItem(boardbg,area); | 251 | board=new CanvasImageItem(boardbg,area); |
252 | board->setX(0); | 252 | board->setX(0); |
253 | board->setY(0); | 253 | board->setY(0); |
254 | board->setZ(0); | 254 | board->setZ(0); |
255 | board->setSize(235-2,200-2); | 255 | board->setSize(235-2,200-2); |
256 | board->show(); | 256 | board->show(); |
257 | 257 | ||
258 | //the table | 258 | //the table |
259 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); | 259 | QImage tablebg(Opie::Core::OResource::loadImage("backgammon/table/"+table_name)); |
260 | table=new CanvasImageItem(tablebg,area); | 260 | table=new CanvasImageItem(tablebg,area); |
261 | table->setX(0); | 261 | table->setX(0); |
262 | table->setY(200-2); | 262 | table->setY(200-2); |
263 | table->setZ(0); | 263 | table->setZ(0); |
264 | table->setSize(235-2,20); | 264 | table->setSize(235-2,20); |
265 | table->show(); | 265 | table->show(); |
266 | 266 | ||
267 | //the no move marker | 267 | //the no move marker |
268 | QImage nomovebg(Resource::loadImage("backgammon/no_move")); | 268 | QImage nomovebg(Opie::Core::OResource::loadImage("backgammon/no_move")); |
269 | nomove_marker=new CanvasImageItem(nomovebg,area); | 269 | nomove_marker=new CanvasImageItem(nomovebg,area); |
270 | nomove_marker->setX(0); | 270 | nomove_marker->setX(0); |
271 | nomove_marker->setY(200); | 271 | nomove_marker->setY(200); |
272 | nomove_marker->setZ(2); | 272 | nomove_marker->setZ(2); |
273 | nomove_marker->hide(); | 273 | nomove_marker->hide(); |
274 | 274 | ||
275 | //default human against computer | 275 | //default human against computer |
276 | player1_auto=false; | 276 | player1_auto=false; |
277 | player2_auto=true; | 277 | player2_auto=true; |
278 | //start new game | 278 | //start new game |
279 | newgame(); | 279 | newgame(); |
280 | } | 280 | } |
281 | 281 | ||
282 | BackGammon::~BackGammon() | 282 | BackGammon::~BackGammon() |
283 | { | 283 | { |
284 | //DESTRUCTOR | 284 | //DESTRUCTOR |
285 | } | 285 | } |
286 | 286 | ||
287 | void BackGammon::newgame() | 287 | void BackGammon::newgame() |
288 | { | 288 | { |
289 | gameFinished=false; | 289 | gameFinished=false; |
290 | QDateTime now=QDateTime::currentDateTime(); | 290 | QDateTime now=QDateTime::currentDateTime(); |
291 | game_name=now.date().toString()+"_"+now.time().toString(); | 291 | game_name=now.date().toString()+"_"+now.time().toString(); |
292 | move->reset(); | 292 | move->reset(); |
293 | draw(); | 293 | draw(); |
294 | diceA1_value=7; | 294 | diceA1_value=7; |
295 | diceA2_value=7; | 295 | diceA2_value=7; |
296 | diceA3_value=7; | 296 | diceA3_value=7; |
297 | diceA4_value=7; | 297 | diceA4_value=7; |
298 | diceB1_value=7; | 298 | diceB1_value=7; |
299 | diceB2_value=7; | 299 | diceB2_value=7; |
300 | diceB3_value=7; | 300 | diceB3_value=7; |
@@ -895,81 +895,81 @@ void BackGammon::showdice() | |||
895 | void BackGammon::setplayer() | 895 | void BackGammon::setplayer() |
896 | { | 896 | { |
897 | if(dice1_played && dice2_played && dice3_played && dice4_played && player==1) | 897 | if(dice1_played && dice2_played && dice3_played && dice4_played && player==1) |
898 | { | 898 | { |
899 | message->setText(tr( "<b>P2 turn</b>", "P means player" )); | 899 | message->setText(tr( "<b>P2 turn</b>", "P means player" )); |
900 | dice_rolled=false; | 900 | dice_rolled=false; |
901 | player=2; | 901 | player=2; |
902 | if(player2_auto) | 902 | if(player2_auto) |
903 | QTimer::singleShot(2000,this,SLOT(autoroll_dice2())); | 903 | QTimer::singleShot(2000,this,SLOT(autoroll_dice2())); |
904 | } | 904 | } |
905 | else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2) | 905 | else if(dice1_played && dice2_played && dice3_played && dice4_played && player==2) |
906 | { | 906 | { |
907 | message->setText(tr( "<b>P1 turn</b>", "P means player" )); | 907 | message->setText(tr( "<b>P1 turn</b>", "P means player" )); |
908 | dice_rolled=false; | 908 | dice_rolled=false; |
909 | player=1; | 909 | player=1; |
910 | if(player1_auto) | 910 | if(player1_auto) |
911 | QTimer::singleShot(2000,this,SLOT(autoroll_dice1())); | 911 | QTimer::singleShot(2000,this,SLOT(autoroll_dice1())); |
912 | } | 912 | } |
913 | } | 913 | } |
914 | 914 | ||
915 | void BackGammon::autoroll_dice1() | 915 | void BackGammon::autoroll_dice1() |
916 | { | 916 | { |
917 | mouse(20,210); | 917 | mouse(20,210); |
918 | } | 918 | } |
919 | 919 | ||
920 | void BackGammon::autoroll_dice2() | 920 | void BackGammon::autoroll_dice2() |
921 | { | 921 | { |
922 | mouse(170,210); | 922 | mouse(170,210); |
923 | } | 923 | } |
924 | 924 | ||
925 | void BackGammon::applytheme() | 925 | void BackGammon::applytheme() |
926 | { | 926 | { |
927 | QImage boardbg(Resource::loadImage("backgammon/boards/"+board_name)); | 927 | QImage boardbg(Opie::Core::OResource::loadImage("backgammon/boards/"+board_name)); |
928 | board->setImage(boardbg); | 928 | board->setImage(boardbg); |
929 | 929 | ||
930 | QImage tablebg(Resource::loadImage("backgammon/table/"+table_name)); | 930 | QImage tablebg(Opie::Core::OResource::loadImage("backgammon/table/"+table_name)); |
931 | table->setImage(tablebg); | 931 | table->setImage(tablebg); |
932 | 932 | ||
933 | QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name)); | 933 | QImage piece_1_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesA_name)); |
934 | QImage piece_1_front=piece_1_all.copy(0,0,15,15); | 934 | QImage piece_1_front=piece_1_all.copy(0,0,15,15); |
935 | QImage piece_1_side=piece_1_all.copy(0,15,15,5); | 935 | QImage piece_1_side=piece_1_all.copy(0,15,15,5); |
936 | 936 | ||
937 | QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name)); | 937 | QImage piece_2_all(Opie::Core::OResource::loadImage("backgammon/pieces/"+piecesB_name)); |
938 | QImage piece_2_front=piece_2_all.copy(0,0,15,15); | 938 | QImage piece_2_front=piece_2_all.copy(0,0,15,15); |
939 | QImage piece_2_side=piece_2_all.copy(0,15,15,5); | 939 | QImage piece_2_side=piece_2_all.copy(0,15,15,5); |
940 | 940 | ||
941 | int a=0; | 941 | int a=0; |
942 | for(a=0;a<15;a++) | 942 | for(a=0;a<15;a++) |
943 | { | 943 | { |
944 | p1[a]->setImage(piece_1_front); | 944 | p1[a]->setImage(piece_1_front); |
945 | p1_side[a]->setImage(piece_1_side); | 945 | p1_side[a]->setImage(piece_1_side); |
946 | 946 | ||
947 | p2[a]->setImage(piece_2_front); | 947 | p2[a]->setImage(piece_2_front); |
948 | p2_side[a]->setImage(piece_2_side); | 948 | p2_side[a]->setImage(piece_2_side); |
949 | } | 949 | } |
950 | draw(); | 950 | draw(); |
951 | 951 | ||
952 | QImage dicebgA_all(Resource::loadImage("backgammon/dice/"+diceA_name)); | 952 | QImage dicebgA_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceA_name)); |
953 | QImage dicebgB_all(Resource::loadImage("backgammon/dice/"+diceB_name)); | 953 | QImage dicebgB_all(Opie::Core::OResource::loadImage("backgammon/dice/"+diceB_name)); |
954 | QImage oddsbg_all=(Resource::loadImage("backgammon/odds/"+odds_name)); | 954 | QImage oddsbg_all=(Opie::Core::OResource::loadImage("backgammon/odds/"+odds_name)); |
955 | 955 | ||
956 | for(a=0;a<7;a++) | 956 | for(a=0;a<7;a++) |
957 | { | 957 | { |
958 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); | 958 | QImage dicebgA=dicebgA_all.copy(a*25,0,25,25); |
959 | diceA1[a]->setImage(dicebgA); | 959 | diceA1[a]->setImage(dicebgA); |
960 | diceA2[a]->setImage(dicebgA); | 960 | diceA2[a]->setImage(dicebgA); |
961 | 961 | ||
962 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); | 962 | QImage dicebgB=dicebgB_all.copy(a*25,0,25,25); |
963 | diceB1[a]->setImage(dicebgB); | 963 | diceB1[a]->setImage(dicebgB); |
964 | diceB2[a]->setImage(dicebgB); | 964 | diceB2[a]->setImage(dicebgB); |
965 | /* | 965 | /* |
966 | if(a<6) | 966 | if(a<6) |
967 | { | 967 | { |
968 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); | 968 | QImage oddsbg=oddsbg_all.copy(a*15,0,15,15); |
969 | oddsDice[a]->setImage(oddsbg); | 969 | oddsDice[a]->setImage(oddsbg); |
970 | } | 970 | } |
971 | */ | 971 | */ |
972 | } | 972 | } |
973 | } | 973 | } |
974 | 974 | ||
975 | 975 | ||
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 | |||
@@ -1,119 +1,111 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "fifteen.h" | 21 | #include "fifteen.h" |
22 | 22 | ||
23 | #include "fifteenconfigdialog.h" | 23 | #include "fifteenconfigdialog.h" |
24 | 24 | ||
25 | #include <opie2/ofileselector.h> | 25 | #include <opie2/ofileselector.h> |
26 | #include <opie2/oresource.h> | ||
26 | 27 | ||
27 | #include <qtopia/resource.h> | ||
28 | #include <qtopia/config.h> | 28 | #include <qtopia/config.h> |
29 | #include <qtopia/qpeapplication.h> | 29 | #include <qtopia/qpeapplication.h> |
30 | 30 | ||
31 | #include <qvbox.h> | 31 | #include <qvbox.h> |
32 | #include <qaction.h> | 32 | #include <qaction.h> |
33 | #include <qpainter.h> | 33 | #include <qpainter.h> |
34 | #include <qmessagebox.h> | 34 | #include <qmessagebox.h> |
35 | #include <qtoolbar.h> | 35 | #include <qtoolbar.h> |
36 | #include <qmenubar.h> | 36 | #include <qmenubar.h> |
37 | #include <qimage.h> | 37 | #include <qimage.h> |
38 | 38 | ||
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include <time.h> | 40 | #include <time.h> |
41 | 41 | ||
42 | FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl) | 42 | FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl) |
43 | : QMainWindow( parent, name, fl ) | 43 | : QMainWindow( parent, name, fl ) |
44 | { | 44 | { |
45 | 45 | ||
46 | // random seed | 46 | // random seed |
47 | srand(time(0)); | 47 | srand(time(0)); |
48 | setCaption( tr("Fifteen Pieces") ); | 48 | setCaption( tr("Fifteen Pieces") ); |
49 | 49 | ||
50 | QToolBar *toolbar = new QToolBar(this); | 50 | QToolBar *toolbar = new QToolBar(this); |
51 | toolbar->setHorizontalStretchable( FALSE ); | 51 | toolbar->setHorizontalStretchable( FALSE ); |
52 | QMenuBar *menubar = new QMenuBar( toolbar ); | 52 | QMenuBar *menubar = new QMenuBar( toolbar ); |
53 | menubar->setMargin(0); | 53 | menubar->setMargin(0); |
54 | QPopupMenu *game = new QPopupMenu( this ); | 54 | QPopupMenu *game = new QPopupMenu( this ); |
55 | menubar->insertItem( tr( "Game" ), game ); | ||
55 | 56 | ||
56 | QWidget *spacer = new QWidget( toolbar ); | 57 | QWidget *spacer = new QWidget( toolbar ); |
57 | spacer->setBackgroundMode( PaletteButton ); | 58 | spacer->setBackgroundMode( PaletteButton ); |
58 | toolbar->setStretchableWidget( spacer ); | 59 | toolbar->setStretchableWidget( spacer ); |
59 | 60 | ||
60 | 61 | ||
61 | setToolBarsMovable( FALSE ); | 62 | setToolBarsMovable( FALSE ); |
62 | QVBox *vbox = new QVBox( this ); | 63 | QVBox *vbox = new QVBox( this ); |
63 | PiecesTable *table = new PiecesTable( vbox ); | 64 | PiecesTable *table = new PiecesTable( vbox ); |
64 | setCentralWidget(vbox); | 65 | setCentralWidget(vbox); |
65 | 66 | ||
66 | 67 | ||
67 | 68 | ||
68 | QAction *a = new QAction( tr( "Randomize" ), Resource::loadPixmap( "new" ), | 69 | QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ), |
69 | QString::null, 0, this, 0 ); | 70 | QString::null, 0, this, 0 ); |
70 | connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) ); | 71 | connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) ); |
71 | a->addTo( game ); | 72 | a->addTo( game ); |
72 | a->addTo( toolbar ); | 73 | a->addTo( toolbar ); |
73 | 74 | ||
74 | 75 | ||
75 | a = new QAction( tr("Configure"), Resource::loadPixmap( "SettingsIcon" ), | 76 | a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), |
76 | QString::null, 0, this, 0 ); | 77 | QString::null, 0, this, 0 ); |
77 | connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) ); | 78 | connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) ); |
78 | a->addTo( game ); | 79 | a->addTo( game ); |
79 | |||
80 | /* This is pointless and confusing. | ||
81 | a = new QAction( tr( "Solve" ), Resource::loadIconSet( "repeat" ), | ||
82 | QString::null, 0, this, 0 ); | ||
83 | connect( a, SIGNAL( activated() ), table, SLOT( slotReset() ) ); | ||
84 | a->addTo( game ); | ||
85 | a->addTo( toolbar ); | ||
86 | */ | ||
87 | menubar->insertItem( tr( "Game" ), game ); | ||
88 | } | 80 | } |
89 | 81 | ||
90 | 82 | ||
91 | 83 | ||
92 | 84 | ||
93 | /////////////// | 85 | /////////////// |
94 | /////// Pieces table Implementation | 86 | /////// Pieces table Implementation |
95 | /////// | 87 | /////// |
96 | PiecesTable::PiecesTable(QWidget* parent, const char* name ) | 88 | PiecesTable::PiecesTable(QWidget* parent, const char* name ) |
97 | : QTableView(parent, name), _menu(0), _randomized(false), | 89 | : QTableView(parent, name), _menu(0), _randomized(false), |
98 | _dialog( 0l ) | 90 | _dialog( 0l ) |
99 | { | 91 | { |
100 | // setup table view | 92 | // setup table view |
101 | setFrameStyle(StyledPanel | Sunken); | 93 | setFrameStyle(StyledPanel | Sunken); |
102 | setBackgroundMode(NoBackground); | 94 | setBackgroundMode(NoBackground); |
103 | setMouseTracking(true); | 95 | setMouseTracking(true); |
104 | 96 | ||
105 | setNumRows(4); | 97 | setNumRows(4); |
106 | setNumCols(4); | 98 | setNumCols(4); |
107 | 99 | ||
108 | // init arrays | 100 | // init arrays |
109 | readConfig(); | 101 | readConfig(); |
110 | initColors(); | 102 | initColors(); |
111 | 103 | ||
112 | } | 104 | } |
113 | 105 | ||
114 | 106 | ||
115 | PiecesTable::~PiecesTable() | 107 | PiecesTable::~PiecesTable() |
116 | { | 108 | { |
117 | writeConfig(); | 109 | writeConfig(); |
118 | clear(); | 110 | clear(); |
119 | } | 111 | } |
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 @@ | |||
1 | config MINDBREAKER | 1 | config MINDBREAKER |
2 | boolean "opie-mindbreaker (crack the coloured code)" | 2 | boolean "opie-mindbreaker (crack the coloured code)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) | 4 | 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,55 +1,56 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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> |
36 | 37 | ||
37 | static int pegRTTI = 3393393; | 38 | static int pegRTTI = 3393393; |
38 | 39 | ||
39 | static int adjusted_panel_height; | 40 | static int adjusted_panel_height; |
40 | static int adjusted_panel_width; | 41 | static int adjusted_panel_width; |
41 | 42 | ||
42 | static int adjusted_bin_margin; | 43 | static int adjusted_bin_margin; |
43 | static int adjusted_peg_size; | 44 | static int adjusted_peg_size; |
44 | static int adjusted_answerpeg_size; | 45 | static int adjusted_answerpeg_size; |
45 | 46 | ||
46 | static int adjusted_title_height; | 47 | static int adjusted_title_height; |
47 | static int adjusted_title_width; | 48 | static int adjusted_title_width; |
48 | 49 | ||
49 | static int adjusted_first_peg_x_diff; | 50 | static int adjusted_first_peg_x_diff; |
50 | static int adjusted_first_peg_y_diff; | 51 | static int adjusted_first_peg_y_diff; |
51 | static int adjusted_peg_spacing; | 52 | static int adjusted_peg_spacing; |
52 | 53 | ||
53 | static int adjusted_answerpegx; | 54 | static int adjusted_answerpegx; |
54 | static int adjusted_answerpegy; | 55 | static int adjusted_answerpegy; |
55 | static int adjusted_answerpeg_xdiff; | 56 | static int adjusted_answerpeg_xdiff; |
@@ -110,83 +111,83 @@ public: | |||
110 | void setPlaced(bool); | 111 | void setPlaced(bool); |
111 | 112 | ||
112 | int pegGo() const; | 113 | int pegGo() const; |
113 | int pegPos() const; | 114 | int pegPos() const; |
114 | void setPegPos(int); | 115 | void setPegPos(int); |
115 | 116 | ||
116 | int type() const; | 117 | int type() const; |
117 | 118 | ||
118 | static void buildImages(); | 119 | static void buildImages(); |
119 | static QImage imageForType(int t); | 120 | static QImage imageForType(int t); |
120 | 121 | ||
121 | static int eggLevel; | 122 | static int eggLevel; |
122 | 123 | ||
123 | protected: | 124 | protected: |
124 | void drawShape(QPainter &); | 125 | void drawShape(QPainter &); |
125 | private: | 126 | private: |
126 | static QVector<QImage> normalPegs; | 127 | static QVector<QImage> normalPegs; |
127 | static QVector<QImage> specialPegs; | 128 | static QVector<QImage> specialPegs; |
128 | 129 | ||
129 | bool isplaced; | 130 | bool isplaced; |
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 | }; |
136 | int Peg::eggLevel = 0; | 137 | int Peg::eggLevel = 0; |
137 | QVector<QImage> Peg::normalPegs; | 138 | QVector<QImage> Peg::normalPegs; |
138 | QVector<QImage> Peg::specialPegs; | 139 | QVector<QImage> Peg::specialPegs; |
139 | 140 | ||
140 | void Peg::buildImages() | 141 | void 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) |
173 | )); | 174 | )); |
174 | y += title_height; | 175 | y += title_height; |
175 | 176 | ||
176 | x = 6 * peg_size; | 177 | x = 6 * peg_size; |
177 | normalPegs.insert(6, | 178 | normalPegs.insert(6, |
178 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). | 179 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). |
179 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); | 180 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); |
180 | x += answerpeg_size; | 181 | x += answerpeg_size; |
181 | normalPegs.insert(7, | 182 | normalPegs.insert(7, |
182 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). | 183 | new QImage(image.copy(x, y, answerpeg_size, answerpeg_size). |
183 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); | 184 | smoothScale( adjusted_answerpeg_size, adjusted_answerpeg_size) )); |
184 | } | 185 | } |
185 | 186 | ||
186 | QImage Peg::imageForType(int t) | 187 | QImage Peg::imageForType(int t) |
187 | { | 188 | { |
188 | if (eggLevel > t ) { | 189 | if (eggLevel > t ) { |
189 | if( t < 5) { | 190 | if( t < 5) { |
190 | return *specialPegs[t]; | 191 | return *specialPegs[t]; |
191 | } else { | 192 | } else { |
192 | return *normalPegs[rand() % 6]; | 193 | return *normalPegs[rand() % 6]; |
@@ -260,67 +261,67 @@ inline void Peg::setPlaced(bool p) | |||
260 | } | 261 | } |
261 | 262 | ||
262 | inline int Peg::type() const | 263 | inline int Peg::type() const |
263 | { | 264 | { |
264 | return pegtype; | 265 | return pegtype; |
265 | } | 266 | } |
266 | 267 | ||
267 | /* Load the main image, copy from it the pegs, the board, and the answer image | 268 | /* Load the main image, copy from it the pegs, the board, and the answer image |
268 | * and use these to create the tray, answer and board | 269 | * and use these to create the tray, answer and board |
269 | */ | 270 | */ |
270 | MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags ) | 271 | MindBreaker::MindBreaker( QWidget *parent, const char *name, int wFlags ) |
271 | : QMainWindow(parent, name, wFlags) | 272 | : QMainWindow(parent, name, wFlags) |
272 | { | 273 | { |
273 | setCaption( tr("Mind Breaker")); | 274 | setCaption( tr("Mind Breaker")); |
274 | QPEApplication::setInputMethodHint( this, QPEApplication::AlwaysOff ); | 275 | QPEApplication::setInputMethodHint( this, QPEApplication::AlwaysOff ); |
275 | setMinimumSize(160,210); | 276 | setMinimumSize(160,210); |
276 | 277 | ||
277 | QWidget *w = new QWidget( this ); | 278 | QWidget *w = new QWidget( this ); |
278 | w->setBackgroundColor( black ); | 279 | w->setBackgroundColor( black ); |
279 | QHBoxLayout *hb = new QHBoxLayout( w ); | 280 | QHBoxLayout *hb = new QHBoxLayout( w ); |
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); |
307 | setScore(a,b); | 308 | setScore(a,b); |
308 | 309 | ||
309 | layout()->setResizeMode(QLayout::FreeResize); | 310 | layout()->setResizeMode(QLayout::FreeResize); |
310 | } | 311 | } |
311 | 312 | ||
312 | void MindBreaker::setScore(int turns, int games) | 313 | void MindBreaker::setScore(int turns, int games) |
313 | { | 314 | { |
314 | double average; | 315 | double average; |
315 | double total_turns = turns; | 316 | double total_turns = turns; |
316 | double total_games = games; | 317 | double total_games = games; |
317 | 318 | ||
318 | if(total_games > 0) | 319 | if(total_games > 0) |
319 | average = total_turns / total_games; | 320 | average = total_turns / total_games; |
320 | else | 321 | else |
321 | average = 0.0; | 322 | average = 0.0; |
322 | 323 | ||
323 | score->setText(tr("win avg: %1 turns (%2 games)").arg(average).arg(games)); | 324 | score->setText(tr("win avg: %1 turns (%2 games)").arg(average).arg(games)); |
324 | } | 325 | } |
325 | 326 | ||
326 | void MindBreaker::resizeEvent( QResizeEvent *e ) | 327 | void MindBreaker::resizeEvent( QResizeEvent *e ) |
@@ -454,65 +455,65 @@ void MindBreakerBoard::getScore(int *a, int *b) | |||
454 | } | 455 | } |
455 | 456 | ||
456 | void MindBreakerBoard::fixSize() | 457 | void MindBreakerBoard::fixSize() |
457 | { | 458 | { |
458 | hide(); | 459 | hide(); |
459 | setMaximumWidth( parentWidget()->height() ); | 460 | setMaximumWidth( parentWidget()->height() ); |
460 | widthTimer->start( 20, TRUE ); | 461 | widthTimer->start( 20, TRUE ); |
461 | } | 462 | } |
462 | 463 | ||
463 | void MindBreakerBoard::doFixSize() | 464 | void MindBreakerBoard::doFixSize() |
464 | { | 465 | { |
465 | QSize s = size(); | 466 | QSize s = size(); |
466 | int fw = frameWidth(); | 467 | int fw = frameWidth(); |
467 | s.setWidth(s.width() - fw); | 468 | s.setWidth(s.width() - fw); |
468 | s.setHeight(s.height() - fw); | 469 | s.setHeight(s.height() - fw); |
469 | 470 | ||
470 | /* min size is 200 x 260 */ | 471 | /* min size is 200 x 260 */ |
471 | /* | 472 | /* |
472 | if (s.width() < adjusted_board_width) | 473 | if (s.width() < adjusted_board_width) |
473 | s.setWidth(adjusted_board_width); | 474 | s.setWidth(adjusted_board_width); |
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); |
499 | show(); | 500 | show(); |
500 | 501 | ||
501 | delete current_highlight; | 502 | delete current_highlight; |
502 | current_highlight = new Peg(canvas(), 8); | 503 | current_highlight = new Peg(canvas(), 8); |
503 | current_highlight->setPlaced(TRUE); | 504 | current_highlight->setPlaced(TRUE); |
504 | current_highlight->setX(0); | 505 | current_highlight->setX(0); |
505 | current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height)); | 506 | current_highlight->setY(adjusted_board_height - ((current_go + 1) * adjusted_panel_height)); |
506 | current_highlight->setZ(0); | 507 | current_highlight->setZ(0); |
507 | current_highlight->show(); | 508 | current_highlight->show(); |
508 | 509 | ||
509 | /* set up the game */ | 510 | /* set up the game */ |
510 | //readConfig(); | 511 | //readConfig(); |
511 | 512 | ||
512 | /* draw initial screen */ | 513 | /* draw initial screen */ |
513 | //drawBackground(); | 514 | //drawBackground(); |
514 | //canvas()->update(); | 515 | //canvas()->update(); |
515 | clear(); | 516 | clear(); |
516 | 517 | ||
517 | readConfig(); | 518 | readConfig(); |
518 | } | 519 | } |
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 @@ | |||
1 | Package: opie-mindbreaker | 1 | Package: opie-mindbreaker |
2 | Files: plugins/application/libmindbreaker.so* bin/mindbreaker apps/Games/mindbreaker.desktop pics/mindbreaker | 2 | Files: plugins/application/libmindbreaker.so* bin/mindbreaker apps/Games/mindbreaker.desktop pics/mindbreaker |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Imobersteg <imm@gmx.ch> | 5 | Maintainer: Martin Imobersteg <imm@gmx.ch> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal, libopiecore2 |
8 | Description: Game: crack the coloured code | 8 | Description: Game: crack the coloured code |
9 | A game for the Opie environment. | 9 | A game for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | 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,57 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "minesweep.h" | 21 | #include "minesweep.h" |
22 | #include "minefield.h" | 22 | #include "minefield.h" |
23 | 23 | ||
24 | #include <opie2/oresource.h> | ||
25 | |||
24 | #include <qtopia/qpeapplication.h> | 26 | #include <qtopia/qpeapplication.h> |
25 | #include <qtopia/resource.h> | ||
26 | #include <qtopia/config.h> | 27 | #include <qtopia/config.h> |
27 | 28 | ||
28 | #include <qtoolbar.h> | 29 | #include <qtoolbar.h> |
29 | #include <qmenubar.h> | 30 | #include <qmenubar.h> |
30 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
31 | #include <qlcdnumber.h> | 32 | #include <qlcdnumber.h> |
32 | #include <qtimer.h> | 33 | #include <qtimer.h> |
33 | #include <qlabel.h> | 34 | #include <qlabel.h> |
34 | 35 | ||
35 | #include <stdlib.h> | 36 | #include <stdlib.h> |
36 | #include <time.h> | 37 | #include <time.h> |
37 | 38 | ||
38 | 39 | ||
39 | 40 | ||
40 | 41 | ||
41 | static const char *pix_new[]={ | 42 | static const char *pix_new[]={ |
42 | "20 20 3 1", | 43 | "20 20 3 1", |
43 | " c None", | 44 | " c None", |
44 | "# c #00FF00", | 45 | "# c #00FF00", |
45 | ". c #000000", | 46 | ". c #000000", |
46 | " ", | 47 | " ", |
47 | " ...... ", | 48 | " ...... ", |
48 | " ..######.. ", | 49 | " ..######.. ", |
49 | " .##########. ", | 50 | " .##########. ", |
50 | " .############. ", | 51 | " .############. ", |
51 | " .##############. ", | 52 | " .##############. ", |
52 | " .##############. ", | 53 | " .##############. ", |
53 | " .################. ", | 54 | " .################. ", |
54 | " .################. ", | 55 | " .################. ", |
55 | " .################. ", | 56 | " .################. ", |
56 | " .################. ", | 57 | " .################. ", |
57 | " .################. ", | 58 | " .################. ", |
@@ -213,65 +214,65 @@ void ResultIndicator::timerEvent( QTimerEvent *te ) | |||
213 | } else { | 214 | } else { |
214 | delete this; | 215 | delete this; |
215 | } | 216 | } |
216 | } | 217 | } |
217 | 218 | ||
218 | 219 | ||
219 | class MineFrame : public QFrame | 220 | class MineFrame : public QFrame |
220 | { | 221 | { |
221 | public: | 222 | public: |
222 | MineFrame( QWidget *parent, const char *name = 0 ) | 223 | MineFrame( QWidget *parent, const char *name = 0 ) |
223 | :QFrame( parent, name ), field(0) {} | 224 | :QFrame( parent, name ), field(0) {} |
224 | void setField( MineField *f ) { | 225 | void setField( MineField *f ) { |
225 | field = f; | 226 | field = f; |
226 | setMinimumSize( field->sizeHint() ); | 227 | setMinimumSize( field->sizeHint() ); |
227 | } | 228 | } |
228 | protected: | 229 | protected: |
229 | void resizeEvent( QResizeEvent *e ) { | 230 | void resizeEvent( QResizeEvent *e ) { |
230 | field->setAvailableRect( contentsRect()); | 231 | field->setAvailableRect( contentsRect()); |
231 | QFrame::resizeEvent(e); | 232 | QFrame::resizeEvent(e); |
232 | } | 233 | } |
233 | private: | 234 | private: |
234 | MineField *field; | 235 | MineField *field; |
235 | }; | 236 | }; |
236 | 237 | ||
237 | 238 | ||
238 | 239 | ||
239 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) | 240 | MineSweep::MineSweep( QWidget* parent, const char* name, WFlags f ) |
240 | : QMainWindow( parent, name, f ) | 241 | : QMainWindow( parent, name, f ) |
241 | { | 242 | { |
242 | srand(::time(0)); | 243 | srand(::time(0)); |
243 | setCaption( tr("Mine Sweep") ); | 244 | setCaption( tr("Mine Sweep") ); |
244 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | 245 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); |
245 | setIcon( Resource::loadPixmap( "minesweep/MineSweep" ) ); | 246 | setIcon( Opie::Core::OResource::loadPixmap( "minesweep/MineSweep" ) ); |
246 | 247 | ||
247 | QToolBar *toolBar = new QToolBar( this ); | 248 | QToolBar *toolBar = new QToolBar( this ); |
248 | toolBar->setHorizontalStretchable( TRUE ); | 249 | toolBar->setHorizontalStretchable( TRUE ); |
249 | 250 | ||
250 | QMenuBar *menuBar = new QMenuBar( toolBar ); | 251 | QMenuBar *menuBar = new QMenuBar( toolBar ); |
251 | 252 | ||
252 | QPopupMenu *gameMenu = new QPopupMenu( this ); | 253 | QPopupMenu *gameMenu = new QPopupMenu( this ); |
253 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); | 254 | gameMenu->insertItem( tr("Beginner"), this, SLOT( beginner() ) ); |
254 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); | 255 | gameMenu->insertItem( tr("Advanced"), this, SLOT( advanced() ) ); |
255 | 256 | ||
256 | if (qApp->desktop()->width() >= 240) { | 257 | if (qApp->desktop()->width() >= 240) { |
257 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); | 258 | gameMenu->insertItem( tr("Expert"), this, SLOT( expert() ) ); |
258 | } | 259 | } |
259 | 260 | ||
260 | menuBar->insertItem( tr("Game"), gameMenu ); | 261 | menuBar->insertItem( tr("Game"), gameMenu ); |
261 | 262 | ||
262 | guessLCD = new QLCDNumber( toolBar ); | 263 | guessLCD = new QLCDNumber( toolBar ); |
263 | toolBar->setStretchableWidget( guessLCD ); | 264 | toolBar->setStretchableWidget( guessLCD ); |
264 | 265 | ||
265 | QPalette lcdPal( red ); | 266 | QPalette lcdPal( red ); |
266 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); | 267 | lcdPal.setColor( QColorGroup::Background, QApplication::palette().active().background() ); |
267 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); | 268 | lcdPal.setColor( QColorGroup::Button, QApplication::palette().active().button() ); |
268 | 269 | ||
269 | // guessLCD->setPalette( lcdPal ); | 270 | // guessLCD->setPalette( lcdPal ); |
270 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); | 271 | guessLCD->setSegmentStyle( QLCDNumber::Flat ); |
271 | guessLCD->setFrameStyle( QFrame::NoFrame ); | 272 | guessLCD->setFrameStyle( QFrame::NoFrame ); |
272 | guessLCD->setNumDigits( 2 ); | 273 | guessLCD->setNumDigits( 2 ); |
273 | guessLCD->setBackgroundMode( PaletteButton ); | 274 | guessLCD->setBackgroundMode( PaletteButton ); |
274 | newGameButton = new QPushButton( toolBar ); | 275 | newGameButton = new QPushButton( toolBar ); |
275 | newGameButton->setPixmap( QPixmap( pix_new ) ); | 276 | newGameButton->setPixmap( QPixmap( pix_new ) ); |
276 | newGameButton->setFocusPolicy(QWidget::NoFocus); | 277 | newGameButton->setFocusPolicy(QWidget::NoFocus); |
277 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); | 278 | connect( newGameButton, SIGNAL(clicked()), this, SLOT(newGame()) ); |
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,66 +1,65 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | #include "codes.h" | 20 | #include "codes.h" |
21 | #include "base.h" | 21 | #include "base.h" |
22 | 22 | ||
23 | #include <qtopia/resource.h> | 23 | #include <opie2/oresource.h> |
24 | |||
25 | 24 | ||
26 | int damage; | 25 | int damage; |
27 | 26 | ||
28 | Base::Base(QCanvas* canvas) : | 27 | Base::Base(QCanvas* canvas) : |
29 | QCanvasSprite(0, canvas), | 28 | QCanvasSprite(0, canvas), |
30 | kaboom("landmine"), | 29 | kaboom("landmine"), |
31 | ohdear("crmble01") | 30 | ohdear("crmble01") |
32 | { | 31 | { |
33 | basearray = new QCanvasPixmapArray(); | 32 | basearray = new QCanvasPixmapArray(); |
34 | QString b0 = Resource::findPixmap("parashoot/b0001"); | 33 | QString b0 = Opie::Core::OResource::findPixmap("parashoot/b0001"); |
35 | b0.replace(QRegExp("0001"),"%1"); | 34 | b0.replace(QRegExp("0001"),"%1"); |
36 | basearray->readPixmaps(b0, 4); | 35 | basearray->readPixmaps(b0, 4); |
37 | setSequence(basearray); | 36 | setSequence(basearray); |
38 | setFrame(0); | 37 | setFrame(0); |
39 | move(2, canvas->height()-50); | 38 | move(2, canvas->height()-50); |
40 | setZ(10); | 39 | setZ(10); |
41 | show(); | 40 | show(); |
42 | damage = 0; | 41 | damage = 0; |
43 | } | 42 | } |
44 | 43 | ||
45 | void Base::damageBase() | 44 | void Base::damageBase() |
46 | { | 45 | { |
47 | damage++; | 46 | damage++; |
48 | 47 | ||
49 | switch(damage) { | 48 | switch(damage) { |
50 | case 1: setFrame(1); ohdear.play(); break; | 49 | case 1: setFrame(1); ohdear.play(); break; |
51 | case 2: setFrame(2); ohdear.play(); break; | 50 | case 2: setFrame(2); ohdear.play(); break; |
52 | case 3: setFrame(3); kaboom.play(); break; | 51 | case 3: setFrame(3); kaboom.play(); break; |
53 | } | 52 | } |
54 | show(); | 53 | show(); |
55 | } | 54 | } |
56 | 55 | ||
57 | bool Base::baseDestroyed() | 56 | bool Base::baseDestroyed() |
58 | { | 57 | { |
59 | return (damage >= 3); | 58 | return (damage >= 3); |
60 | } | 59 | } |
61 | 60 | ||
62 | Base::~Base() | 61 | Base::~Base() |
63 | { | 62 | { |
64 | } | 63 | } |
65 | 64 | ||
66 | int Base::rtti() const | 65 | int Base::rtti() const |
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 | |||
@@ -1,70 +1,71 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "codes.h" | 21 | #include "codes.h" |
22 | #include "bullet.h" | 22 | #include "bullet.h" |
23 | #include "man.h" | 23 | #include "man.h" |
24 | #include "helicopter.h" | 24 | #include "helicopter.h" |
25 | 25 | ||
26 | #include <qpe/resource.h> | 26 | #include <opie2/oresource.h> |
27 | |||
27 | #include <qpe/qmath.h> | 28 | #include <qpe/qmath.h> |
28 | 29 | ||
29 | 30 | ||
30 | int limit; | 31 | int limit; |
31 | int shotcount; | 32 | int shotcount; |
32 | int nobullets; | 33 | int nobullets; |
33 | 34 | ||
34 | Bullet::Bullet(QCanvas* canvas, double angle, int cannonx, int cannony) : | 35 | Bullet::Bullet(QCanvas* canvas, double angle, int cannonx, int cannony) : |
35 | QCanvasSprite(0, canvas), | 36 | QCanvasSprite(0, canvas), |
36 | bang("collide01") | 37 | bang("collide01") |
37 | { | 38 | { |
38 | QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Resource::findPixmap("parashoot/bullet")); | 39 | QCanvasPixmapArray* bulletarray = new QCanvasPixmapArray(Opie::Core::OResource::findPixmap("parashoot/bullet")); |
39 | setSequence(bulletarray); | 40 | setSequence(bulletarray); |
40 | if (nobullets < limit) { | 41 | if (nobullets < limit) { |
41 | nobullets++; | 42 | nobullets++; |
42 | move(cannonx, cannony); | 43 | move(cannonx, cannony); |
43 | dy = 0; | 44 | dy = 0; |
44 | dx = 0; | 45 | dx = 0; |
45 | show(); | 46 | show(); |
46 | setXY(angle); | 47 | setXY(angle); |
47 | setVelocity(-dx, -dy); | 48 | setVelocity(-dx, -dy); |
48 | bang.play(); | 49 | bang.play(); |
49 | } else | 50 | } else |
50 | return; | 51 | return; |
51 | } | 52 | } |
52 | 53 | ||
53 | void Bullet::setXY(double angle) | 54 | void Bullet::setXY(double angle) |
54 | { | 55 | { |
55 | double ang = angle; | 56 | double ang = angle; |
56 | if ( (y() < 0) || (x() < 0) || (y() > canvas()->height()) || | 57 | if ( (y() < 0) || (x() < 0) || (y() > canvas()->height()) || |
57 | (x() > canvas()->width()) ) | 58 | (x() > canvas()->width()) ) |
58 | delete this; | 59 | delete this; |
59 | else { | 60 | else { |
60 | double radians = 0; | 61 | double radians = 0; |
61 | radians = ang * 3.14159265/180; | 62 | radians = ang * 3.14159265/180; |
62 | dx = (qCos(radians)) *7; | 63 | dx = (qCos(radians)) *7; |
63 | dy = (qSin(radians)) *7; | 64 | dy = (qSin(radians)) *7; |
64 | } | 65 | } |
65 | } | 66 | } |
66 | 67 | ||
67 | void Bullet::setLimit(int amount) | 68 | void Bullet::setLimit(int amount) |
68 | { | 69 | { |
69 | limit = amount; | 70 | limit = amount; |
70 | } | 71 | } |
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,67 +1,66 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 <qtopia/resource.h> | 21 | #include <opie2/oresource.h> |
22 | |||
23 | 22 | ||
24 | #include "codes.h" | 23 | #include "codes.h" |
25 | #include "cannon.h" | 24 | #include "cannon.h" |
26 | 25 | ||
27 | Cannon::Cannon(QCanvas* canvas) : | 26 | Cannon::Cannon(QCanvas* canvas) : |
28 | QCanvasSprite(0, canvas) | 27 | QCanvasSprite(0, canvas) |
29 | { | 28 | { |
30 | shotsfired=0; | 29 | shotsfired=0; |
31 | index = 8; | 30 | index = 8; |
32 | cannonx = 0; | 31 | cannonx = 0; |
33 | cannony = 0; | 32 | cannony = 0; |
34 | cannonarray = new QCanvasPixmapArray(); | 33 | cannonarray = new QCanvasPixmapArray(); |
35 | QString c0 = Resource::findPixmap("parashoot/can0001"); | 34 | QString c0 = Opie::Core::OResource::findPixmap("parashoot/can0001"); |
36 | c0.replace(QRegExp("0001"),"%1"); | 35 | c0.replace(QRegExp("0001"),"%1"); |
37 | cannonarray->readPixmaps(c0,17); | 36 | cannonarray->readPixmaps(c0,17); |
38 | setSequence(cannonarray); | 37 | setSequence(cannonarray); |
39 | setFrame(index); | 38 | setFrame(index); |
40 | 39 | ||
41 | reposition(); | 40 | reposition(); |
42 | 41 | ||
43 | movedir = NoDir; | 42 | movedir = NoDir; |
44 | moveDelay = 0; | 43 | moveDelay = 0; |
45 | setAnimated(TRUE); | 44 | setAnimated(TRUE); |
46 | show(); | 45 | show(); |
47 | } | 46 | } |
48 | 47 | ||
49 | void Cannon::advance(int stage) | 48 | void Cannon::advance(int stage) |
50 | { | 49 | { |
51 | if ( stage == 1 && moveDelay-- == 0 ) { | 50 | if ( stage == 1 && moveDelay-- == 0 ) { |
52 | if (movedir == Left) { | 51 | if (movedir == Left) { |
53 | if (index > 0) { | 52 | if (index > 0) { |
54 | setFrame(index-1); | 53 | setFrame(index-1); |
55 | index--; | 54 | index--; |
56 | } | 55 | } |
57 | } | 56 | } |
58 | if (movedir == Right) { | 57 | if (movedir == Right) { |
59 | if (index < 16) { | 58 | if (index < 16) { |
60 | setFrame(index+1); | 59 | setFrame(index+1); |
61 | index++; | 60 | index++; |
62 | } | 61 | } |
63 | } | 62 | } |
64 | moveDelay = 0; | 63 | moveDelay = 0; |
65 | } | 64 | } |
66 | } | 65 | } |
67 | 66 | ||
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,69 +1,69 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "helicopter.h" | 21 | #include "helicopter.h" |
22 | #include "man.h" | 22 | #include "man.h" |
23 | #include "codes.h" | 23 | #include "codes.h" |
24 | 24 | ||
25 | #include <qtopia/resource.h> | 25 | #include <opie2/oresource.h> |
26 | 26 | ||
27 | 27 | ||
28 | static QList<Helicopter> all; | 28 | static QList<Helicopter> all; |
29 | 29 | ||
30 | Helicopter::Helicopter(QCanvas* canvas) : | 30 | Helicopter::Helicopter(QCanvas* canvas) : |
31 | QCanvasSprite(0, canvas), | 31 | QCanvasSprite(0, canvas), |
32 | chikachika("aland01") | 32 | chikachika("aland01") |
33 | { | 33 | { |
34 | all.append(this); | 34 | all.append(this); |
35 | hits = 0; | 35 | hits = 0; |
36 | QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray(); | 36 | QCanvasPixmapArray* helicopterarray = new QCanvasPixmapArray(); |
37 | QString h0 = Resource::findPixmap("parashoot/helicopter0001"); | 37 | QString h0 = Opie::Core::OResource::findPixmap("parashoot/helicopter0001"); |
38 | h0.replace(QRegExp("0001"),"%1"); | 38 | h0.replace(QRegExp("0001"),"%1"); |
39 | helicopterarray->readPixmaps(h0,4 ); | 39 | helicopterarray->readPixmaps(h0,4 ); |
40 | 40 | ||
41 | setSequence(helicopterarray); | 41 | setSequence(helicopterarray); |
42 | setAnimated(true); | 42 | setAnimated(true); |
43 | move(canvas->width(), 5); | 43 | move(canvas->width(), 5); |
44 | setVelocity(-2, 0); | 44 | setVelocity(-2, 0); |
45 | chikachika.playLoop(); | 45 | chikachika.playLoop(); |
46 | show(); | 46 | show(); |
47 | } | 47 | } |
48 | 48 | ||
49 | Helicopter::~Helicopter() | 49 | Helicopter::~Helicopter() |
50 | { | 50 | { |
51 | all.remove(this); | 51 | all.remove(this); |
52 | } | 52 | } |
53 | 53 | ||
54 | int fr = 0; | 54 | int fr = 0; |
55 | 55 | ||
56 | void Helicopter::advance(int phase) | 56 | void Helicopter::advance(int phase) |
57 | { | 57 | { |
58 | QCanvasSprite::advance(phase); | 58 | QCanvasSprite::advance(phase); |
59 | if (phase == 0) { | 59 | if (phase == 0) { |
60 | if (frame() == 3) { | 60 | if (frame() == 3) { |
61 | delete this; | 61 | delete this; |
62 | return; | 62 | return; |
63 | } | 63 | } |
64 | 64 | ||
65 | if (hits >= 2) { | 65 | if (hits >= 2) { |
66 | setFrame(3); | 66 | setFrame(3); |
67 | } else { | 67 | } else { |
68 | setFrame(fr%3); | 68 | setFrame(fr%3); |
69 | fr++; | 69 | fr++; |
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,114 +1,116 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "interface.h" | 21 | #include "interface.h" |
22 | #include "man.h" | 22 | #include "man.h" |
23 | 23 | ||
24 | #include <opie2/oresource.h> | ||
25 | |||
24 | #include <qtopia/qpeapplication.h> | 26 | #include <qtopia/qpeapplication.h> |
25 | #include <qtopia/resource.h> | ||
26 | 27 | ||
27 | #include <qtoolbar.h> | 28 | #include <qtoolbar.h> |
28 | #include <qtoolbutton.h> | 29 | #include <qtoolbutton.h> |
29 | 30 | ||
30 | ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : | 31 | ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : |
31 | QMainWindow(parent,name,f), | 32 | QMainWindow(parent,name,f), |
32 | canvas( 232, 258 ), | 33 | canvas( 232, 258 ), |
33 | cannon(NULL), | 34 | cannon(NULL), |
34 | base(NULL), | 35 | base(NULL), |
35 | gamestopped( true ), | 36 | gamestopped( true ), |
36 | waitover( false ), | 37 | waitover( false ), |
37 | fanfare("level_up"), | 38 | fanfare("level_up"), |
38 | score(0) | 39 | score(0) |
39 | { | 40 | { |
40 | QPEApplication::grabKeyboard(); | 41 | QPEApplication::grabKeyboard(); |
41 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | 42 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); |
42 | 43 | ||
43 | updatespeed = 80; | 44 | updatespeed = 80; |
44 | canvas.setAdvancePeriod(80); | 45 | canvas.setAdvancePeriod(80); |
45 | 46 | ||
46 | pb = new QCanvasView(&canvas, this); | 47 | pb = new QCanvasView(&canvas, this); |
47 | pb->setFocus(); | 48 | pb->setFocus(); |
48 | 49 | ||
49 | setToolBarsMovable( FALSE ); | 50 | setToolBarsMovable( FALSE ); |
50 | 51 | ||
51 | QToolBar* toolbar = new QToolBar(this); | 52 | QToolBar* toolbar = new QToolBar(this); |
52 | toolbar->setHorizontalStretchable( TRUE ); | 53 | toolbar->setHorizontalStretchable( TRUE ); |
53 | 54 | ||
54 | setCaption( tr("ParaShoot") ); | 55 | setCaption( tr("ParaShoot") ); |
55 | new QToolButton( Resource::loadIconSet("new"), tr("New Game"), 0, | 56 | QToolButton *btn = new QToolButton( Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon), |
56 | this, SLOT(newGame()), toolbar, "New Game"); | 57 | tr("New Game"), 0, this, SLOT(newGame()), toolbar, "New Game"); |
58 | btn->setUsesBigPixmap( qApp->desktop()->size().width() > 330 ); | ||
57 | 59 | ||
58 | levelscore = new QLabel(toolbar); | 60 | levelscore = new QLabel(toolbar); |
59 | levelscore->setBackgroundMode( PaletteButton ); | 61 | levelscore->setBackgroundMode( PaletteButton ); |
60 | levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); | 62 | levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); |
61 | toolbar->setStretchableWidget( levelscore ); | 63 | toolbar->setStretchableWidget( levelscore ); |
62 | showScore(0,0); | 64 | showScore(0,0); |
63 | 65 | ||
64 | setCentralWidget(pb); | 66 | setCentralWidget(pb); |
65 | 67 | ||
66 | autoDropTimer = new QTimer(this); | 68 | autoDropTimer = new QTimer(this); |
67 | connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) ); | 69 | connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) ); |
68 | 70 | ||
69 | pauseTimer = new QTimer(this); | 71 | pauseTimer = new QTimer(this); |
70 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); | 72 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); |
71 | 73 | ||
72 | setFocusPolicy(StrongFocus); | 74 | setFocusPolicy(StrongFocus); |
73 | } | 75 | } |
74 | 76 | ||
75 | 77 | ||
76 | void ParaShoot::resizeEvent(QResizeEvent *) | 78 | void ParaShoot::resizeEvent(QResizeEvent *) |
77 | { | 79 | { |
78 | QSize s = centralWidget()->size(); | 80 | QSize s = centralWidget()->size(); |
79 | int fw = style().defaultFrameWidth(); | 81 | int fw = style().defaultFrameWidth(); |
80 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); | 82 | canvas.resize( s.width() - fw - 2, s.height() - fw - 2); |
81 | 83 | ||
82 | QImage bgimage = Resource::loadImage("parashoot/sky"); | 84 | QImage bgimage = Opie::Core::OResource::loadImage("parashoot/sky"); |
83 | QPixmap bgpixmap; | 85 | QPixmap bgpixmap; |
84 | 86 | ||
85 | bgpixmap.convertFromImage(bgimage.smoothScale(canvas.width(), | 87 | bgpixmap.convertFromImage(bgimage.smoothScale(canvas.width(), |
86 | canvas.height()), QPixmap::Auto); | 88 | canvas.height()), QPixmap::Auto); |
87 | canvas.setBackgroundPixmap(bgpixmap); | 89 | canvas.setBackgroundPixmap(bgpixmap); |
88 | 90 | ||
89 | if (base) { | 91 | if (base) { |
90 | base->reposition(); | 92 | base->reposition(); |
91 | } | 93 | } |
92 | 94 | ||
93 | if (cannon) { | 95 | if (cannon) { |
94 | cannon->reposition(); | 96 | cannon->reposition(); |
95 | } | 97 | } |
96 | } | 98 | } |
97 | 99 | ||
98 | void ParaShoot::focusOutEvent (QFocusEvent *) | 100 | void ParaShoot::focusOutEvent (QFocusEvent *) |
99 | { | 101 | { |
100 | if (!gamestopped) | 102 | if (!gamestopped) |
101 | canvas.setAdvancePeriod(-1); | 103 | canvas.setAdvancePeriod(-1); |
102 | } | 104 | } |
103 | 105 | ||
104 | void ParaShoot::focusInEvent (QFocusEvent *) | 106 | void ParaShoot::focusInEvent (QFocusEvent *) |
105 | { | 107 | { |
106 | if (!gamestopped) | 108 | if (!gamestopped) |
107 | canvas.setAdvancePeriod(updatespeed); | 109 | canvas.setAdvancePeriod(updatespeed); |
108 | } | 110 | } |
109 | 111 | ||
110 | void ParaShoot::showScore( int score, int level ) | 112 | void ParaShoot::showScore( int score, int level ) |
111 | { | 113 | { |
112 | levelscore->setText(tr(" Level: %1 Score: %2 ").arg(score).arg(level) ); | 114 | levelscore->setText(tr(" Level: %1 Score: %2 ").arg(score).arg(level) ); |
113 | } | 115 | } |
114 | 116 | ||
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,82 +1,81 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "codes.h" | 21 | #include "codes.h" |
22 | #include "man.h" | 22 | #include "man.h" |
23 | #include "base.h" | 23 | #include "base.h" |
24 | 24 | ||
25 | #include <qtopia/resource.h> | 25 | #include <opie2/oresource.h> |
26 | |||
27 | 26 | ||
28 | int mancount; | 27 | int mancount; |
29 | 28 | ||
30 | Man::Man(QCanvas* canvas) : | 29 | Man::Man(QCanvas* canvas) : |
31 | QCanvasSprite(0, canvas), | 30 | QCanvasSprite(0, canvas), |
32 | splat("lose") // No tr | 31 | splat("lose") // No tr |
33 | { | 32 | { |
34 | manarray = new QCanvasPixmapArray(); | 33 | manarray = new QCanvasPixmapArray(); |
35 | QString m0 = Resource::findPixmap("parashoot/man0001"); | 34 | QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001"); |
36 | m0.replace(QRegExp("0001"),"%1"); | 35 | m0.replace(QRegExp("0001"),"%1"); |
37 | manarray->readPixmaps(m0, 7); | 36 | manarray->readPixmaps(m0, 7); |
38 | setSequence(manarray); | 37 | setSequence(manarray); |
39 | setAnimated(true); | 38 | setAnimated(true); |
40 | mancount++; | 39 | mancount++; |
41 | dead = false; | 40 | dead = false; |
42 | start(); | 41 | start(); |
43 | } | 42 | } |
44 | 43 | ||
45 | Man::Man(QCanvas* canvas, int x, int y) : | 44 | Man::Man(QCanvas* canvas, int x, int y) : |
46 | QCanvasSprite(0, canvas), | 45 | QCanvasSprite(0, canvas), |
47 | splat("bang") // No tr | 46 | splat("bang") // No tr |
48 | { | 47 | { |
49 | manarray = new QCanvasPixmapArray(); | 48 | manarray = new QCanvasPixmapArray(); |
50 | QString m0 = Resource::findPixmap("parashoot/man0001"); | 49 | QString m0 = Opie::Core::OResource::findPixmap("parashoot/man0001"); |
51 | m0.replace(QString("0001"),"%1"); | 50 | m0.replace(QString("0001"),"%1"); |
52 | manarray->readPixmaps(m0, 7); | 51 | manarray->readPixmaps(m0, 7); |
53 | setSequence(manarray); | 52 | setSequence(manarray); |
54 | move(x, y); | 53 | move(x, y); |
55 | setFrame(5); | 54 | setFrame(5); |
56 | setZ(300); | 55 | setZ(300); |
57 | show(); | 56 | show(); |
58 | 57 | ||
59 | static bool first_time = TRUE; | 58 | static bool first_time = TRUE; |
60 | if (first_time) { | 59 | if (first_time) { |
61 | first_time = FALSE; | 60 | first_time = FALSE; |
62 | QTime midnight(0, 0, 0); | 61 | QTime midnight(0, 0, 0); |
63 | srand(midnight.secsTo(QTime::currentTime()) ); | 62 | srand(midnight.secsTo(QTime::currentTime()) ); |
64 | } | 63 | } |
65 | int yfallspeed = 0; | 64 | int yfallspeed = 0; |
66 | yfallspeed = (rand() % 3) + 1; | 65 | yfallspeed = (rand() % 3) + 1; |
67 | setVelocity(0, yfallspeed); | 66 | setVelocity(0, yfallspeed); |
68 | 67 | ||
69 | mancount++; | 68 | mancount++; |
70 | dead = false; | 69 | dead = false; |
71 | } | 70 | } |
72 | int f = 0; | 71 | int f = 0; |
73 | 72 | ||
74 | void Man::advance(int phase) | 73 | void Man::advance(int phase) |
75 | { | 74 | { |
76 | QCanvasSprite::advance(phase); | 75 | QCanvasSprite::advance(phase); |
77 | if (phase == 0) { | 76 | if (phase == 0) { |
78 | checkCollision(); | 77 | checkCollision(); |
79 | if (dead) { | 78 | if (dead) { |
80 | if (count < 10) { | 79 | if (count < 10) { |
81 | setFrame(6); | 80 | setFrame(6); |
82 | setVelocity(0,0); | 81 | setVelocity(0,0); |
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,55 +1,55 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "canvascard.h" | 21 | #include "canvascard.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <opie2/oresource.h> |
24 | 24 | ||
25 | #include <qgfx_qws.h> // Needed to get the device's width | 25 | #include <qgfx_qws.h> // Needed to get the device's width |
26 | 26 | ||
27 | #include <math.h> | 27 | #include <math.h> |
28 | 28 | ||
29 | #if defined( QT_QWS_CASSIOPEIA ) | 29 | #if defined( QT_QWS_CASSIOPEIA ) |
30 | #define SLOW_HARDWARE | 30 | #define SLOW_HARDWARE |
31 | #endif | 31 | #endif |
32 | 32 | ||
33 | // Seems to be fast enough to me even without Transformations in the library | 33 | // Seems to be fast enough to me even without Transformations in the library |
34 | //#if defined( QT_NO_TRANSFORMATIONS ) && defined( QT_QWS_IPAQ ) | 34 | //#if defined( QT_NO_TRANSFORMATIONS ) && defined( QT_QWS_IPAQ ) |
35 | //#define SLOW_HARDWARE | 35 | //#define SLOW_HARDWARE |
36 | //#endif | 36 | //#endif |
37 | 37 | ||
38 | 38 | ||
39 | QBitmap *Create180RotatedBitmap(QBitmap *srcBitmap) | 39 | QBitmap *Create180RotatedBitmap(QBitmap *srcBitmap) |
40 | { | 40 | { |
41 | #ifdef QT_NO_TRANSFORMATIONS | 41 | #ifdef QT_NO_TRANSFORMATIONS |
42 | int w = srcBitmap->width(); | 42 | int w = srcBitmap->width(); |
43 | int h = srcBitmap->height(); | 43 | int h = srcBitmap->height(); |
44 | QBitmap *dstBitmap = new QBitmap( w, h ); | 44 | QBitmap *dstBitmap = new QBitmap( w, h ); |
45 | // ### this is very poorly implemented and probably could be much faster | 45 | // ### this is very poorly implemented and probably could be much faster |
46 | for (int i = 0; i < w; i++) | 46 | for (int i = 0; i < w; i++) |
47 | for (int j = 0; j < h; j++) | 47 | for (int j = 0; j < h; j++) |
48 | bitBlt( dstBitmap, i, j, srcBitmap, w - i - 1, h - j - 1, 1, 1 ); | 48 | bitBlt( dstBitmap, i, j, srcBitmap, w - i - 1, h - j - 1, 1, 1 ); |
49 | return dstBitmap; | 49 | return dstBitmap; |
50 | #else | 50 | #else |
51 | QWMatrix m; | 51 | QWMatrix m; |
52 | m.rotate( 180.0 ); | 52 | m.rotate( 180.0 ); |
53 | return new QBitmap( srcBitmap->xForm( m ) ); | 53 | return new QBitmap( srcBitmap->xForm( m ) ); |
54 | #endif | 54 | #endif |
55 | } | 55 | } |
@@ -70,157 +70,152 @@ QPixmap *CreateScaledPixmap(QPixmap *srcPixmap, double scaleX, double scaleY) | |||
70 | // Optimise for scaleing in the X-axis only | 70 | // Optimise for scaleing in the X-axis only |
71 | bitBlt( dstPixmap, i, 0, srcPixmap, srcX, 0, 1, h ); | 71 | bitBlt( dstPixmap, i, 0, srcPixmap, srcX, 0, 1, h ); |
72 | } else { | 72 | } else { |
73 | for (int j = 0; j < newH; j++) { | 73 | for (int j = 0; j < newH; j++) { |
74 | int srcY = h * j / newH; | 74 | int srcY = h * j / newH; |
75 | bitBlt( dstPixmap, i, j, srcPixmap, srcX, srcY, 1, 1 ); | 75 | bitBlt( dstPixmap, i, j, srcPixmap, srcX, srcY, 1, 1 ); |
76 | } | 76 | } |
77 | } | 77 | } |
78 | } | 78 | } |
79 | return dstPixmap; | 79 | return dstPixmap; |
80 | #else | 80 | #else |
81 | QWMatrix s; | 81 | QWMatrix s; |
82 | s.scale( scaleX, scaleY ); | 82 | s.scale( scaleX, scaleY ); |
83 | return new QPixmap( srcPixmap->xForm( s ) ); | 83 | return new QPixmap( srcPixmap->xForm( s ) ); |
84 | #endif | 84 | #endif |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | // Initialise static member variables to NULL | 88 | // Initialise static member variables to NULL |
89 | QPixmap *CanvasCard::cardsFaces = NULL; | 89 | QPixmap *CanvasCard::cardsFaces = NULL; |
90 | QPixmap *CanvasCard::cardsBacks = NULL; | 90 | QPixmap *CanvasCard::cardsBacks = NULL; |
91 | QBitmap *CanvasCard::cardsChars = NULL; | 91 | QBitmap *CanvasCard::cardsChars = NULL; |
92 | QBitmap *CanvasCard::cardsSuits = NULL; | 92 | QBitmap *CanvasCard::cardsSuits = NULL; |
93 | QBitmap *CanvasCard::cardsCharsUpsideDown = NULL; | 93 | QBitmap *CanvasCard::cardsCharsUpsideDown = NULL; |
94 | QBitmap *CanvasCard::cardsSuitsUpsideDown = NULL; | 94 | QBitmap *CanvasCard::cardsSuitsUpsideDown = NULL; |
95 | 95 | ||
96 | 96 | ||
97 | CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) : | 97 | CanvasCard::CanvasCard( eValue v, eSuit s, bool f, QCanvas *canvas ) : |
98 | Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0) | 98 | Card(v, s, f), QCanvasRectangle( 0, 0, 1, 1, canvas ), cardBack(1), scaleX(1.0), scaleY(1.0) |
99 | { | 99 | { |
100 | if ( !cardsFaces ) { | 100 | if ( !cardsFaces ) { |
101 | if ( qt_screen->deviceWidth() < 200 ) { | 101 | if ( qt_screen->deviceWidth() < 200 ) { |
102 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face_small" ) ); | 102 | cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face_small" ) ); |
103 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); | 103 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) ); |
104 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars_small" ) ); | 104 | cardsChars = new QBitmap(); |
105 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits_small" ) ); | 105 | *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars_small" ); |
106 | cardsSuits = new QBitmap(); | ||
107 | *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits_small" ); | ||
106 | } else { | 108 | } else { |
107 | cardsFaces = new QPixmap( Resource::loadPixmap( "cards/card_face" ) ); | 109 | cardsFaces = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_face" ) ); |
108 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); | 110 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) ); |
109 | cardsChars = new QBitmap( Resource::loadBitmap( "cards/card_chars" ) ); | 111 | cardsChars = new QBitmap(); |
110 | cardsSuits = new QBitmap( Resource::loadBitmap( "cards/card_suits" ) ); | 112 | *cardsChars = Opie::Core::OResource::loadPixmap( "cards/card_chars" ); |
113 | cardsSuits = new QBitmap(); | ||
114 | *cardsSuits = Opie::Core::OResource::loadPixmap( "cards/card_suits" ); | ||
111 | } | 115 | } |
112 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); | 116 | cardsCharsUpsideDown = Create180RotatedBitmap( cardsChars ); |
113 | cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits ); | 117 | cardsSuitsUpsideDown = Create180RotatedBitmap( cardsSuits ); |
114 | } | 118 | } |
115 | xOff = cardsFaces->width() / 2; | 119 | xOff = cardsFaces->width() / 2; |
116 | yOff = cardsFaces->height() / 2; | 120 | yOff = cardsFaces->height() / 2; |
117 | setSize( cardsFaces->width(), cardsFaces->height() ); | 121 | setSize( cardsFaces->width(), cardsFaces->height() ); |
118 | setPen( NoPen ); | 122 | setPen( NoPen ); |
119 | flipping = FALSE; | 123 | flipping = FALSE; |
120 | } | 124 | } |
121 | 125 | ||
122 | 126 | ||
123 | void CanvasCard::setCardBack(int b) | 127 | void CanvasCard::setCardBack(int b) |
124 | { | 128 | { |
125 | if ( cardBack != b ) { | 129 | if ( cardBack != b ) { |
126 | 130 | ||
127 | cardBack = b; | 131 | cardBack = b; |
128 | 132 | ||
129 | if ( cardsBacks ) | 133 | if ( cardsBacks ) |
130 | delete cardsBacks; | 134 | delete cardsBacks; |
131 | 135 | ||
132 | if ( qt_screen->deviceWidth() < 200 ) { | 136 | if ( qt_screen->deviceWidth() < 200 ) { |
133 | switch (cardBack) { | 137 | switch (cardBack) { |
134 | case 0: | 138 | case 0: |
135 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001_small" ) ); break; | 139 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001_small" ) ); break; |
136 | case 1: | 140 | case 1: |
137 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002_small" ) ); break; | 141 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002_small" ) ); break; |
138 | case 2: | 142 | case 2: |
139 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003_small" ) ); break; | 143 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003_small" ) ); break; |
140 | case 3: | 144 | case 3: |
141 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004_small" ) ); break; | 145 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004_small" ) ); break; |
142 | case 4: | 146 | case 4: |
143 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005_small" ) ); break; | 147 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005_small" ) ); break; |
144 | } | 148 | } |
145 | } else { | 149 | } else { |
146 | switch (cardBack) { | 150 | switch (cardBack) { |
147 | case 0: | 151 | case 0: |
148 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0001" ) ); break; | 152 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0001" ) ); break; |
149 | case 1: | 153 | case 1: |
150 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0002" ) ); break; | 154 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0002" ) ); break; |
151 | case 2: | 155 | case 2: |
152 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0003" ) ); break; | 156 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0003" ) ); break; |
153 | case 3: | 157 | case 3: |
154 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0004" ) ); break; | 158 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0004" ) ); break; |
155 | case 4: | 159 | case 4: |
156 | cardsBacks = new QPixmap( Resource::loadPixmap( "cards/card_back0005" ) ); break; | 160 | cardsBacks = new QPixmap( Opie::Core::OResource::loadPixmap( "cards/card_back0005" ) ); break; |
157 | } | 161 | } |
158 | } | 162 | } |
159 | 163 | ||
160 | if ( !isFacing() ) | 164 | if ( !isFacing() ) |
161 | redraw(); | 165 | redraw(); |
162 | } | 166 | } |
163 | } | 167 | } |
164 | 168 | ||
165 | 169 | ||
166 | void CanvasCard::draw(QPainter &painter) | 170 | void CanvasCard::draw(QPainter &painter) |
167 | { | 171 | { |
168 | int ix = (int)x(), iy = (int)y(); | 172 | int ix = (int)x(), iy = (int)y(); |
169 | 173 | ||
170 | QPainter *p = &painter; | 174 | QPainter *p = &painter; |
171 | QPixmap *unscaledCard = NULL; | 175 | QPixmap *unscaledCard = NULL; |
172 | 176 | ||
173 | if ((scaleX <= 0.98) || (scaleY <= 0.98)) | 177 | if ((scaleX <= 0.98) || (scaleY <= 0.98)) |
174 | { | 178 | { |
175 | p = new QPainter(); | 179 | p = new QPainter(); |
176 | unscaledCard = new QPixmap( cardsFaces->width(), cardsFaces->height() ); | 180 | unscaledCard = new QPixmap( cardsFaces->width(), cardsFaces->height() ); |
177 | p->begin(unscaledCard); | 181 | p->begin(unscaledCard); |
178 | ix = 0; | 182 | ix = 0; |
179 | iy = 0; | 183 | iy = 0; |
180 | } | 184 | } |
181 | 185 | ||
182 | if ( isFacing() ) { | 186 | if ( isFacing() ) { |
183 | 187 | ||
184 | /* | ||
185 | // Now add the joker and card backs to the list of pixmaps | ||
186 | QPixmap *CardsBack = new QPixmap( Resource::loadPixmap( "cards/card_joker.png" ) ); | ||
187 | QPoint *newBackHotspot = new QPoint( 0, 0 ); | ||
188 | pixmaps->append((const QPixmap *)CardsBack); | ||
189 | hotspots->append((const QPoint *)newBackHotspot); | ||
190 | */ | ||
191 | |||
192 | int w = cardsFaces->width(), h = cardsFaces->height(); | 188 | int w = cardsFaces->width(), h = cardsFaces->height(); |
193 | 189 | ||
194 | //p->setBrush( NoBrush ); | ||
195 | p->setBrush( QColor( 0xFF, 0xFF, 0xFF ) ); | 190 | p->setBrush( QColor( 0xFF, 0xFF, 0xFF ) ); |
196 | 191 | ||
197 | if ( isRed() == TRUE ) | 192 | if ( isRed() == TRUE ) |
198 | p->setPen( QColor( 0xFF, 0, 0 ) ); | 193 | p->setPen( QColor( 0xFF, 0, 0 ) ); |
199 | else | 194 | else |
200 | p->setPen( QColor( 0, 0, 0 ) ); | 195 | p->setPen( QColor( 0, 0, 0 ) ); |
201 | 196 | ||
202 | if ( qt_screen->deviceWidth() < 200 ) { | 197 | if ( qt_screen->deviceWidth() < 200 ) { |
203 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | 198 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); |
204 | p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 ); | 199 | p->drawPixmap( ix + 3, iy + 3, *cardsChars, 5*(getValue()-1), 0, 5, 6 ); |
205 | p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 ); | 200 | p->drawPixmap( ix + 11, iy + 3, *cardsSuits, 5*(getSuit()-1), 0, 5, 6 ); |
206 | p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 ); | 201 | p->drawPixmap( ix + w-3-5, iy + h-3-6, *cardsCharsUpsideDown, 5*(12-getValue()+1), 0, 5, 6 ); |
207 | p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 ); | 202 | p->drawPixmap( ix + w-11-5, iy + h-3-6, *cardsSuitsUpsideDown, 5*(3-getSuit()+1), 0, 5, 6 ); |
208 | } else { | 203 | } else { |
209 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); | 204 | p->drawPixmap( ix + 0, iy + 0, *cardsFaces ); |
210 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); | 205 | p->drawPixmap( ix + 4, iy + 4, *cardsChars, 7*(getValue()-1), 0, 7, 7 ); |
211 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); | 206 | p->drawPixmap( ix + 12, iy + 4, *cardsSuits, 7*(getSuit()-1), 0, 7, 8 ); |
212 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); | 207 | p->drawPixmap( ix + w-4-7, iy + h-4-7, *cardsCharsUpsideDown, 7*(12-getValue()+1), 0, 7, 7 ); |
213 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); | 208 | p->drawPixmap( ix + w-12-7, iy + h-5-7, *cardsSuitsUpsideDown, 7*(3-getSuit()+1), 0, 7, 8 ); |
214 | } | 209 | } |
215 | 210 | ||
216 | } else { | 211 | } else { |
217 | 212 | ||
218 | p->drawPixmap( ix, iy, *cardsBacks ); | 213 | p->drawPixmap( ix, iy, *cardsBacks ); |
219 | 214 | ||
220 | } | 215 | } |
221 | 216 | ||
222 | if (p != &painter) | 217 | if (p != &painter) |
223 | { | 218 | { |
224 | p->end(); | 219 | p->end(); |
225 | QPixmap *scaledCard = CreateScaledPixmap( unscaledCard, scaleX, scaleY ); | 220 | QPixmap *scaledCard = CreateScaledPixmap( unscaledCard, scaleX, scaleY ); |
226 | int xoff = scaledCard->width() / 2; | 221 | int xoff = scaledCard->width() / 2; |
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 | |||
@@ -1,59 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | #ifndef CANVAS_CARD_GAME_H | 20 | #ifndef CANVAS_CARD_GAME_H |
21 | #define CANVAS_CARD_GAME_H | 21 | #define CANVAS_CARD_GAME_H |
22 | 22 | ||
23 | #include "cardgame.h" | 23 | #include "cardgame.h" |
24 | #include "canvasshapes.h" | 24 | #include "canvasshapes.h" |
25 | #include "canvascard.h" | 25 | #include "canvascard.h" |
26 | 26 | ||
27 | #include <qpe/resource.h> | ||
28 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
29 | 28 | ||
30 | #include <qmainwindow.h> | 29 | #include <qmainwindow.h> |
31 | #include <qmenubar.h> | 30 | #include <qmenubar.h> |
32 | #include <qpainter.h> | 31 | #include <qpainter.h> |
33 | 32 | ||
34 | #include <stdlib.h> | 33 | #include <stdlib.h> |
35 | #include <time.h> | 34 | #include <time.h> |
36 | 35 | ||
37 | 36 | ||
38 | class CanvasCardPile; | 37 | class CanvasCardPile; |
39 | 38 | ||
40 | 39 | ||
41 | class CanvasCardGame : public QCanvasView, public CardGame | 40 | class CanvasCardGame : public QCanvasView, public CardGame |
42 | { | 41 | { |
43 | public: | 42 | public: |
44 | CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) : | 43 | CanvasCardGame(QCanvas &c, bool snap, QWidget *parent = 0, int numOfDecks = 1, const char *name = 0, WFlags f = 0) : |
45 | QCanvasView( &c, parent, name, f ), | 44 | QCanvasView( &c, parent, name, f ), |
46 | CardGame(0,numOfDecks), | 45 | CardGame(0,numOfDecks), |
47 | moved(FALSE), | 46 | moved(FALSE), |
48 | moving(NULL), | 47 | moving(NULL), |
49 | alphaCardPile( NULL ), | 48 | alphaCardPile( NULL ), |
50 | cardXOff(0), cardYOff(0), | 49 | cardXOff(0), cardYOff(0), |
51 | snapOn(snap), | 50 | snapOn(snap), |
52 | numberToDraw(1) { } | 51 | numberToDraw(1) { } |
53 | 52 | ||
54 | virtual ~CanvasCardGame(); | 53 | virtual ~CanvasCardGame(); |
55 | 54 | ||
56 | virtual Card *newCard( eValue v, eSuit s, bool f ) { | 55 | virtual Card *newCard( eValue v, eSuit s, bool f ) { |
57 | return new CanvasCard( v, s, f, canvas() ); | 56 | return new CanvasCard( v, s, f, canvas() ); |
58 | } | 57 | } |
59 | 58 | ||
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 | |||
@@ -1,76 +1,75 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 "canvascardwindow.h" | 21 | #include "canvascardwindow.h" |
22 | #include "freecellcardgame.h" | 22 | #include "freecellcardgame.h" |
23 | #include "chicanecardgame.h" | 23 | #include "chicanecardgame.h" |
24 | #include "harpcardgame.h" | 24 | #include "harpcardgame.h" |
25 | #include "teeclubcardgame.h" | 25 | #include "teeclubcardgame.h" |
26 | 26 | ||
27 | 27 | #include <opie2/oresource.h> | |
28 | |||
29 | 28 | ||
30 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : | 29 | CanvasCardWindow::CanvasCardWindow(QWidget* parent, const char* name, WFlags f) : |
31 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), | 30 | QMainWindow(parent, name, f), canvas(230, 260), snapOn(TRUE), cardBack(4), gameType(0), |
32 | cardGame(NULL) | 31 | cardGame(NULL) |
33 | { | 32 | { |
34 | setIcon( Resource::loadPixmap( "cards" ) ); | 33 | setIcon( Opie::Core::OResource::loadPixmap( "cards" ) ); |
35 | setCaption(tr("Patience")); | 34 | setCaption(tr("Patience")); |
36 | 35 | ||
37 | // Create Playing Area for Games | 36 | // Create Playing Area for Games |
38 | if ( QPixmap::defaultDepth() < 12 ) { | 37 | if ( QPixmap::defaultDepth() < 12 ) { |
39 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); | 38 | // canvas.setBackgroundColor(QColor(0x51, 0x74, 0x6B)); |
40 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); | 39 | // canvas.setBackgroundColor(QColor(0x20, 0xb0, 0x50)); |
41 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); | 40 | canvas.setBackgroundColor(QColor(0x08, 0x98, 0x2D)); |
42 | } else { | 41 | } else { |
43 | QPixmap bg; | 42 | QPixmap bg; |
44 | bg.convertFromImage( Resource::loadImage( "table_pattern" ), ThresholdDither ); | 43 | bg.convertFromImage( Opie::Core::OResource::loadImage( "table_pattern" ), ThresholdDither ); |
45 | canvas.setBackgroundPixmap(bg); | 44 | canvas.setBackgroundPixmap(bg); |
46 | } | 45 | } |
47 | 46 | ||
48 | #if defined( QT_QWS_CASSIOPEIA ) | 47 | #if defined( QT_QWS_CASSIOPEIA ) |
49 | canvas.setAdvancePeriod(70); | 48 | canvas.setAdvancePeriod(70); |
50 | #else | 49 | #else |
51 | canvas.setAdvancePeriod(30); | 50 | canvas.setAdvancePeriod(30); |
52 | #endif | 51 | #endif |
53 | 52 | ||
54 | 53 | ||
55 | #ifdef _PATIENCE_USE_ACCELS_ | 54 | #ifdef _PATIENCE_USE_ACCELS_ |
56 | QMenuBar* menu = menuBar(); | 55 | QMenuBar* menu = menuBar(); |
57 | 56 | ||
58 | QPopupMenu* file = new QPopupMenu; | 57 | QPopupMenu* file = new QPopupMenu; |
59 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); | 58 | file->insertItem(tr("Patience"), this, SLOT(initPatience()), CTRL+Key_F); |
60 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); | 59 | file->insertItem(tr("Freecell"), this, SLOT(initFreecell()), CTRL+Key_F); |
61 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); | 60 | file->insertItem(tr("Chicane"), this, SLOT(initChicane()), CTRL+Key_F); |
62 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); | 61 | file->insertItem(tr("Harp"), this, SLOT(initHarp()), CTRL+Key_F); |
63 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); | 62 | file->insertItem(tr("Teeclub"), this, SLOT(initTeeclub()), CTRL+Key_F); |
64 | menu->insertItem(tr("&Game"), file); | 63 | menu->insertItem(tr("&Game"), file); |
65 | 64 | ||
66 | menu->insertSeparator(); | 65 | menu->insertSeparator(); |
67 | 66 | ||
68 | settings = new QPopupMenu; | 67 | settings = new QPopupMenu; |
69 | settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); | 68 | settings->insertItem(tr("&Change card backs"), this, SLOT(changeCardBacks()), Key_F2); |
70 | snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); | 69 | snap_id = settings->insertItem(tr("&Snap to position"), this, SLOT(snapToggle()), Key_F3); |
71 | settings->setCheckable(TRUE); | 70 | settings->setCheckable(TRUE); |
72 | menu->insertItem(tr("&Settings"),settings); | 71 | menu->insertItem(tr("&Settings"),settings); |
73 | 72 | ||
74 | menu->insertSeparator(); | 73 | menu->insertSeparator(); |
75 | 74 | ||
76 | QPopupMenu* help = new QPopupMenu; | 75 | QPopupMenu* help = 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,56 +1,56 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | 21 | ||
22 | #include "qtetrix.h" | 22 | #include "qtetrix.h" |
23 | 23 | ||
24 | #include <qpe/resource.h> | 24 | #include <opie2/oresource.h> |
25 | 25 | ||
26 | #include <qlabel.h> | 26 | #include <qlabel.h> |
27 | #include <qdatetime.h> | 27 | #include <qdatetime.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qtimer.h> | 29 | #include <qtimer.h> |
30 | 30 | ||
31 | #include "ohighscoredlg.h" | 31 | #include "ohighscoredlg.h" |
32 | 32 | ||
33 | 33 | ||
34 | void drawTetrixButton( QPainter *p, int x, int y, int w, int h, | 34 | void drawTetrixButton( QPainter *p, int x, int y, int w, int h, |
35 | const QColor *color ) | 35 | const QColor *color ) |
36 | { | 36 | { |
37 | QColor fc; | 37 | QColor fc; |
38 | if ( color ) { | 38 | if ( color ) { |
39 | QPointArray a; | 39 | QPointArray a; |
40 | a.setPoints( 3, x,y+h-1, x,y, x+w-1,y ); | 40 | a.setPoints( 3, x,y+h-1, x,y, x+w-1,y ); |
41 | p->setPen( color->light() ); | 41 | p->setPen( color->light() ); |
42 | p->drawPolyline( a ); | 42 | p->drawPolyline( a ); |
43 | a.setPoints( 3, x+1,y+h-1, x+w-1,y+h-1, x+w-1,y+1 ); | 43 | a.setPoints( 3, x+1,y+h-1, x+w-1,y+h-1, x+w-1,y+1 ); |
44 | p->setPen( color->dark() ); | 44 | p->setPen( color->dark() ); |
45 | p->drawPolyline( a ); | 45 | p->drawPolyline( a ); |
46 | x++; | 46 | x++; |
47 | y++; | 47 | y++; |
48 | w -= 2; | 48 | w -= 2; |
49 | h -= 2; | 49 | h -= 2; |
50 | fc = *color; | 50 | fc = *color; |
51 | } | 51 | } |
52 | else | 52 | else |
53 | fc = p->backgroundColor(); | 53 | fc = p->backgroundColor(); |
54 | p->fillRect( x, y, w, h, fc ); | 54 | p->fillRect( x, y, w, h, fc ); |
55 | } | 55 | } |
56 | 56 | ||
@@ -68,65 +68,65 @@ void ShowNextPiece::resizeEvent( QResizeEvent *e ) | |||
68 | blockWidth = (sz.width() - 3)/5; | 68 | blockWidth = (sz.width() - 3)/5; |
69 | blockHeight = (sz.height() - 3)/6; | 69 | blockHeight = (sz.height() - 3)/6; |
70 | xOffset = (sz.width() - 3)/5; | 70 | xOffset = (sz.width() - 3)/5; |
71 | yOffset = (sz.height() - 3)/6; | 71 | yOffset = (sz.height() - 3)/6; |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | void ShowNextPiece::paintEvent( QPaintEvent * ) | 75 | void ShowNextPiece::paintEvent( QPaintEvent * ) |
76 | { | 76 | { |
77 | QPainter p( this ); | 77 | QPainter p( this ); |
78 | drawFrame( &p ); | 78 | drawFrame( &p ); |
79 | p.end(); // explicit end() so any slots can paint too | 79 | p.end(); // explicit end() so any slots can paint too |
80 | emit update(); | 80 | emit update(); |
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | void ShowNextPiece::drawNextSquare(int x, int y,QColor *color) | 84 | void ShowNextPiece::drawNextSquare(int x, int y,QColor *color) |
85 | { | 85 | { |
86 | if (xOffset == -1) // Before first resizeEvent? | 86 | if (xOffset == -1) // Before first resizeEvent? |
87 | return; | 87 | return; |
88 | 88 | ||
89 | QPainter paint; | 89 | QPainter paint; |
90 | paint.begin(this); | 90 | paint.begin(this); |
91 | drawTetrixButton( &paint, xOffset+x*blockWidth, yOffset+y*blockHeight, | 91 | drawTetrixButton( &paint, xOffset+x*blockWidth, yOffset+y*blockHeight, |
92 | blockWidth, blockHeight, color ); | 92 | blockWidth, blockHeight, color ); |
93 | paint.end(); | 93 | paint.end(); |
94 | } | 94 | } |
95 | 95 | ||
96 | 96 | ||
97 | QTetrix::QTetrix( QWidget *parent, const char *name, WFlags f ) | 97 | QTetrix::QTetrix( QWidget *parent, const char *name, WFlags f ) |
98 | : QMainWindow( parent, name, f ) | 98 | : QMainWindow( parent, name, f ) |
99 | { | 99 | { |
100 | setIcon( Resource::loadPixmap( "tetrix_icon" ) ); | 100 | setIcon( Opie::Core::OResource::loadPixmap( "tetrix_icon" ) ); |
101 | setCaption( tr("Tetrix" ) ); | 101 | setCaption( tr("Tetrix" ) ); |
102 | 102 | ||
103 | QTime t = QTime::currentTime(); | 103 | QTime t = QTime::currentTime(); |
104 | TetrixPiece::setRandomSeed( (((double)t.hour())+t.minute()+t.second())/ | 104 | TetrixPiece::setRandomSeed( (((double)t.hour())+t.minute()+t.second())/ |
105 | (24+60+60) ); | 105 | (24+60+60) ); |
106 | 106 | ||
107 | QWidget *gameArea = new QWidget( this ); | 107 | QWidget *gameArea = new QWidget( this ); |
108 | setCentralWidget( gameArea ); | 108 | setCentralWidget( gameArea ); |
109 | 109 | ||
110 | QGridLayout *gl = new QGridLayout( gameArea, 5, 3, 8 ); | 110 | QGridLayout *gl = new QGridLayout( gameArea, 5, 3, 8 ); |
111 | gl->setColStretch( 1, 5 ); | 111 | gl->setColStretch( 1, 5 ); |
112 | gl->setColStretch( 2, 10 ); | 112 | gl->setColStretch( 2, 10 ); |
113 | 113 | ||
114 | QLabel *l; | 114 | QLabel *l; |
115 | l = new QLabel( tr("Next"), gameArea ); | 115 | l = new QLabel( tr("Next"), gameArea ); |
116 | gl->addWidget( l, 0, 0 ); | 116 | gl->addWidget( l, 0, 0 ); |
117 | showNext = new ShowNextPiece(gameArea); | 117 | showNext = new ShowNextPiece(gameArea); |
118 | showNext->setBackgroundColor(QColor(0,0,0)); | 118 | showNext->setBackgroundColor(QColor(0,0,0)); |
119 | gl->addWidget( showNext, 0, 1 ); | 119 | gl->addWidget( showNext, 0, 1 ); |
120 | 120 | ||
121 | l = new QLabel( tr("Score"), gameArea ); | 121 | l = new QLabel( tr("Score"), gameArea ); |
122 | gl->addWidget( l, 1, 0 ); | 122 | gl->addWidget( l, 1, 0 ); |
123 | showScore = new QLabel(gameArea); | 123 | showScore = new QLabel(gameArea); |
124 | gl->addWidget( showScore, 1, 1 ); | 124 | gl->addWidget( showScore, 1, 1 ); |
125 | l = new QLabel( tr("Level"), gameArea ); | 125 | l = new QLabel( tr("Level"), gameArea ); |
126 | gl->addWidget( l, 2, 0 ); | 126 | gl->addWidget( l, 2, 0 ); |
127 | showLevel = new QLabel(gameArea); | 127 | showLevel = new QLabel(gameArea); |
128 | gl->addWidget( showLevel, 2, 1 ); | 128 | gl->addWidget( showLevel, 2, 1 ); |
129 | l = new QLabel( tr("Removed"), gameArea ); | 129 | l = new QLabel( tr("Removed"), gameArea ); |
130 | gl->addWidget( l, 3, 0 ); | 130 | gl->addWidget( l, 3, 0 ); |
131 | showLines = new QLabel(gameArea); | 131 | showLines = new QLabel(gameArea); |
132 | gl->addWidget( showLines, 3, 1 ); | 132 | gl->addWidget( showLines, 3, 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,57 +1,58 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
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 | 21 | ||
22 | #include "wordgame.h" | 22 | #include "wordgame.h" |
23 | 23 | ||
24 | #include <opie2/oresource.h> | ||
25 | |||
24 | #include <qpe/global.h> | 26 | #include <qpe/global.h> |
25 | #include <qpe/resource.h> | ||
26 | #include <qpe/config.h> | 27 | #include <qpe/config.h> |
27 | 28 | ||
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
30 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
31 | #include <qdir.h> | 32 | #include <qdir.h> |
32 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
33 | #include <qpushbutton.h> | 34 | #include <qpushbutton.h> |
34 | #include <qtextstream.h> | 35 | #include <qtextstream.h> |
35 | #include <qtimer.h> | 36 | #include <qtimer.h> |
36 | #include <qtoolbar.h> | 37 | #include <qtoolbar.h> |
37 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
38 | #include <qvbox.h> | 39 | #include <qvbox.h> |
39 | #include <qwidgetstack.h> | 40 | #include <qwidgetstack.h> |
40 | #include <qlayout.h> | 41 | #include <qlayout.h> |
41 | 42 | ||
42 | #include <stdlib.h> | 43 | #include <stdlib.h> |
43 | #include <unistd.h> | 44 | #include <unistd.h> |
44 | #include <pwd.h> | 45 | #include <pwd.h> |
45 | #include <sys/types.h> | 46 | #include <sys/types.h> |
46 | 47 | ||
47 | enum RuleEffects { | 48 | enum RuleEffects { |
48 | Multiplier=15, | 49 | Multiplier=15, |
49 | MultiplyAll=64, | 50 | MultiplyAll=64, |
50 | Start=128 | 51 | Start=128 |
51 | }; | 52 | }; |
52 | 53 | ||
53 | static int tile_smallw = 16; | 54 | static int tile_smallw = 16; |
54 | static int tile_smallh = 16; | 55 | static int tile_smallh = 16; |
55 | static int tile_bigw = 22; | 56 | static int tile_bigw = 22; |
56 | static int tile_bigh = 22; | 57 | static int tile_bigh = 22; |
57 | static int tile_stweak = -2; | 58 | static int tile_stweak = -2; |
@@ -89,78 +90,85 @@ const char* sampleWGR= | |||
89 | "2 y 3\n" | 90 | "2 y 3\n" |
90 | "2 h 2\n" | 91 | "2 h 2\n" |
91 | "2 b 2\n" | 92 | "2 b 2\n" |
92 | "2 m 2\n" | 93 | "2 m 2\n" |
93 | "3 p 2\n" | 94 | "3 p 2\n" |
94 | "3 g 2\n" | 95 | "3 g 2\n" |
95 | "3 u 2\n" | 96 | "3 u 2\n" |
96 | "4 d 2\n" | 97 | "4 d 2\n" |
97 | "4 c 2\n" | 98 | "4 c 2\n" |
98 | "5 l 1\n" | 99 | "5 l 1\n" |
99 | "5 o 1\n" | 100 | "5 o 1\n" |
100 | "7 t 1\n" | 101 | "7 t 1\n" |
101 | "7 n 1\n" | 102 | "7 n 1\n" |
102 | "7 a 1\n" | 103 | "7 a 1\n" |
103 | "7 r 1\n" | 104 | "7 r 1\n" |
104 | "8 s 1\n" | 105 | "8 s 1\n" |
105 | "8 i 1\n" | 106 | "8 i 1\n" |
106 | "11 e 1\n" | 107 | "11 e 1\n" |
107 | "0\n"; | 108 | "0\n"; |
108 | 109 | ||
109 | WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : | 110 | WordGame::WordGame( QWidget* parent, const char* name, WFlags fl ) : |
110 | QMainWindow(parent, name, fl) | 111 | QMainWindow(parent, name, fl) |
111 | { | 112 | { |
112 | if ( qApp->desktop()->width() < 240 ) { | 113 | if ( qApp->desktop()->width() < 240 ) { |
113 | tile_smallw = 10; | 114 | tile_smallw = 10; |
114 | tile_smallh = 10; | 115 | tile_smallh = 10; |
115 | tile_bigw = 16; | 116 | tile_bigw = 16; |
116 | tile_bigh = 16; | 117 | tile_bigh = 16; |
117 | tile_stweak = 0; | 118 | tile_stweak = 0; |
118 | tile_btweak = 0; | 119 | tile_btweak = 0; |
119 | } | 120 | } |
120 | 121 | ||
121 | setIcon( Resource::loadPixmap( "wordgame/WordGame.png" ) ); | 122 | setIcon( Opie::Core::OResource::loadPixmap( "wordgame/WordGame" ) ); |
122 | setCaption( tr("Word Game") ); | 123 | setCaption( tr("Word Game") ); |
123 | 124 | ||
124 | setToolBarsMovable( FALSE ); | 125 | setToolBarsMovable( FALSE ); |
125 | vbox = new QVBox(this); | 126 | vbox = new QVBox(this); |
126 | 127 | ||
127 | setCentralWidget(vbox); | 128 | setCentralWidget(vbox); |
128 | toolbar = new QToolBar(this); | 129 | toolbar = new QToolBar(this); |
129 | addToolBar(toolbar, Bottom); | 130 | addToolBar(toolbar, Bottom); |
130 | reset = new QToolButton(Resource::loadPixmap("back"), tr("Back"), "", this, SLOT(resetTurn()), toolbar); | 131 | bool useBigIcon = qApp->desktop()->size().width() > 330; |
131 | done = new QToolButton(Resource::loadPixmap("done"), tr("Done"), "", this, SLOT(endTurn()), toolbar); | 132 | reset = new QToolButton(Opie::Core::OResource::loadPixmap("back", Opie::Core::OResource::SmallIcon), |
133 | tr("Back"), "", this, SLOT(resetTurn()), toolbar); | ||
134 | reset->setUsesBigPixmap( useBigIcon ); | ||
135 | done = new QToolButton(Opie::Core::OResource::loadPixmap("done", Opie::Core::OResource::SmallIcon), | ||
136 | tr("Done"), "", this, SLOT(endTurn()), toolbar); | ||
137 | done->setUsesBigPixmap( useBigIcon ); | ||
132 | scoreinfo = new ScoreInfo(toolbar); | 138 | scoreinfo = new ScoreInfo(toolbar); |
133 | scoreinfo->setFont(QFont("Helvetica",10)); | 139 | scoreinfo->setFont(QFont("Helvetica",10)); |
134 | new QToolButton(Resource::loadPixmap("finish"), tr("Close"), "", this, SLOT(endGame()), toolbar); | 140 | QToolButton *btn = new QToolButton(Opie::Core::OResource::loadPixmap("finish", Opie::Core::OResource::SmallIcon), |
141 | tr("Close"), "", this, SLOT(endGame()), toolbar); | ||
142 | btn->setUsesBigPixmap( useBigIcon ); | ||
135 | toolbar->setStretchableWidget(scoreinfo); | 143 | toolbar->setStretchableWidget(scoreinfo); |
136 | 144 | ||
137 | cpu = 0; | 145 | cpu = 0; |
138 | board = 0; | 146 | board = 0; |
139 | bag = 0; | 147 | bag = 0; |
140 | racks = 0; | 148 | racks = 0; |
141 | 149 | ||
142 | aiheart = new QTimer(this); | 150 | aiheart = new QTimer(this); |
143 | connect(aiheart, SIGNAL(timeout()), this, SLOT(think())); | 151 | connect(aiheart, SIGNAL(timeout()), this, SLOT(think())); |
144 | 152 | ||
145 | readConfig(); | 153 | readConfig(); |
146 | } | 154 | } |
147 | 155 | ||
148 | WordGame::~WordGame() | 156 | WordGame::~WordGame() |
149 | { | 157 | { |
150 | writeConfig(); | 158 | writeConfig(); |
151 | } | 159 | } |
152 | 160 | ||
153 | void WordGame::writeConfig() | 161 | void WordGame::writeConfig() |
154 | { | 162 | { |
155 | Config cfg("WordGame"); | 163 | Config cfg("WordGame"); |
156 | cfg.setGroup("Game"); | 164 | cfg.setGroup("Game"); |
157 | cfg.writeEntry("NameList",namelist,';'); | 165 | cfg.writeEntry("NameList",namelist,';'); |
158 | cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1); | 166 | cfg.writeEntry("CurrentPlayer",gameover ? 0 : player+1); |
159 | if ( !gameover ) { | 167 | if ( !gameover ) { |
160 | cfg.writeEntry("Rules",rules); | 168 | cfg.writeEntry("Rules",rules); |
161 | bag->writeConfig(cfg); | 169 | bag->writeConfig(cfg); |
162 | board->writeConfig(cfg); | 170 | board->writeConfig(cfg); |
163 | scoreinfo->writeConfig(cfg); | 171 | scoreinfo->writeConfig(cfg); |
164 | } | 172 | } |
165 | for (int p=0; p<nplayers; p++) { | 173 | for (int p=0; p<nplayers; p++) { |
166 | cfg.setGroup("Player"+QString::number(p+1)); | 174 | cfg.setGroup("Player"+QString::number(p+1)); |
@@ -276,65 +284,65 @@ bool WordGame::loadRules(const QString &name) | |||
276 | QFile file( filename ); | 284 | QFile file( filename ); |
277 | if ( !file.open( IO_ReadOnly ) ) | 285 | if ( !file.open( IO_ReadOnly ) ) |
278 | return FALSE; | 286 | return FALSE; |
279 | 287 | ||
280 | QTextStream ts( &file ); | 288 | QTextStream ts( &file ); |
281 | 289 | ||
282 | QString title = name; | 290 | QString title = name; |
283 | title.truncate( title.length() - 6 ); | 291 | title.truncate( title.length() - 6 ); |
284 | //setCaption( title ); | 292 | //setCaption( title ); |
285 | 293 | ||
286 | QString shapepixmap; | 294 | QString shapepixmap; |
287 | ts >> shapepixmap; | 295 | ts >> shapepixmap; |
288 | int htiles,vtiles; | 296 | int htiles,vtiles; |
289 | ts >> htiles >> vtiles; | 297 | ts >> htiles >> vtiles; |
290 | 298 | ||
291 | if ( htiles < 3 || vtiles < 3 ) | 299 | if ( htiles < 3 || vtiles < 3 ) |
292 | return FALSE; | 300 | return FALSE; |
293 | 301 | ||
294 | QString rule_shapes; | 302 | QString rule_shapes; |
295 | for (int i=0; i<vtiles; i++) { | 303 | for (int i=0; i<vtiles; i++) { |
296 | QString line; | 304 | QString line; |
297 | ts >> line; | 305 | ts >> line; |
298 | rule_shapes += line; | 306 | rule_shapes += line; |
299 | } | 307 | } |
300 | static int rule_effects[12]; | 308 | static int rule_effects[12]; |
301 | int re=0,e; | 309 | int re=0,e; |
302 | ts >> e; | 310 | ts >> e; |
303 | while ( e && re < 10 ) { | 311 | while ( e && re < 10 ) { |
304 | rule_effects[re] = e; | 312 | rule_effects[re] = e; |
305 | if ( re++ < 10 ) ts >> e; | 313 | if ( re++ < 10 ) ts >> e; |
306 | } | 314 | } |
307 | 315 | ||
308 | QImage shim = Resource::loadImage("wordgame/wordgame_shapes"); | 316 | QImage shim = Opie::Core::OResource::loadImage("wordgame/wordgame_shapes"); |
309 | shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight()); | 317 | shim = shim.smoothScale((re-1)*TileItem::smallWidth(),TileItem::smallHeight()); |
310 | QPixmap bgshapes; | 318 | QPixmap bgshapes; |
311 | bgshapes.convertFromImage(shim); | 319 | bgshapes.convertFromImage(shim); |
312 | 320 | ||
313 | rule_effects[re++] = 100; // default bonus | 321 | rule_effects[re++] = 100; // default bonus |
314 | board = new Board(bgshapes, htiles, vtiles, vbox); | 322 | board = new Board(bgshapes, htiles, vtiles, vbox); |
315 | board->setRules(rule_shapes, rule_effects); | 323 | board->setRules(rule_shapes, rule_effects); |
316 | connect(board, SIGNAL(temporaryScore(int)), scoreinfo, SLOT(showTemporaryScore(int))); | 324 | connect(board, SIGNAL(temporaryScore(int)), scoreinfo, SLOT(showTemporaryScore(int))); |
317 | 325 | ||
318 | bag = new Bag; | 326 | bag = new Bag; |
319 | 327 | ||
320 | int count; | 328 | int count; |
321 | ts >> count; | 329 | ts >> count; |
322 | while ( count ) { | 330 | while ( count ) { |
323 | QString text; | 331 | QString text; |
324 | int value; | 332 | int value; |
325 | ts >> text >> value; | 333 | ts >> text >> value; |
326 | if ( text == "_" ) | 334 | if ( text == "_" ) |
327 | text = ""; | 335 | text = ""; |
328 | 336 | ||
329 | Tile t(text, value); | 337 | Tile t(text, value); |
330 | for (int n=count; n--; ) | 338 | for (int n=count; n--; ) |
331 | bag->add(t); | 339 | bag->add(t); |
332 | 340 | ||
333 | ts >> count; | 341 | ts >> count; |
334 | } | 342 | } |
335 | 343 | ||
336 | return TRUE; | 344 | return TRUE; |
337 | } | 345 | } |
338 | 346 | ||
339 | 347 | ||
340 | NewGame::NewGame(QWidget* parent) : | 348 | NewGame::NewGame(QWidget* parent) : |
@@ -1333,65 +1341,65 @@ void Rack::resizeEvent(QResizeEvent* e) | |||
1333 | { | 1341 | { |
1334 | canvas()->resize(width()-frameWidth()*2,height()-frameWidth()*2); | 1342 | canvas()->resize(width()-frameWidth()*2,height()-frameWidth()*2); |
1335 | QCanvasView::resizeEvent(e); | 1343 | QCanvasView::resizeEvent(e); |
1336 | } | 1344 | } |
1337 | 1345 | ||
1338 | void Rack::contentsMousePressEvent(QMouseEvent* e) | 1346 | void Rack::contentsMousePressEvent(QMouseEvent* e) |
1339 | { | 1347 | { |
1340 | if ( computerized() ) | 1348 | if ( computerized() ) |
1341 | return; | 1349 | return; |
1342 | QCanvasItemList list = canvas()->collisions(e->pos()); | 1350 | QCanvasItemList list = canvas()->collisions(e->pos()); |
1343 | if (list.count()) { | 1351 | if (list.count()) { |
1344 | dragging = list.first(); | 1352 | dragging = list.first(); |
1345 | dragstart = e->pos()-QPoint(int(dragging->x()),int(dragging->y())); | 1353 | dragstart = e->pos()-QPoint(int(dragging->x()),int(dragging->y())); |
1346 | } else { | 1354 | } else { |
1347 | dragging = 0; | 1355 | dragging = 0; |
1348 | } | 1356 | } |
1349 | } | 1357 | } |
1350 | 1358 | ||
1351 | void Rack::contentsMouseMoveEvent(QMouseEvent* e) | 1359 | void Rack::contentsMouseMoveEvent(QMouseEvent* e) |
1352 | { | 1360 | { |
1353 | if ( computerized() ) | 1361 | if ( computerized() ) |
1354 | return; | 1362 | return; |
1355 | //int w = TileItem::bigWidth()+2; | 1363 | //int w = TileItem::bigWidth()+2; |
1356 | if ( dragging ) { | 1364 | if ( dragging ) { |
1357 | dragging_adj = TileItem::bigWidth()/2; | 1365 | dragging_adj = TileItem::bigWidth()/2; |
1358 | if ( dragging->x() > e->x()-dragstart.x() ) | 1366 | if ( dragging->x() > e->x()-dragstart.x() ) |
1359 | dragging_adj = -dragging_adj; | 1367 | dragging_adj = -dragging_adj; |
1360 | dragging->move(e->x()-dragstart.x(),0); | 1368 | dragging->move(e->x()-dragstart.x(),0); |
1361 | layoutTiles(); | 1369 | layoutTiles(); |
1362 | } | 1370 | } |
1363 | } | 1371 | } |
1364 | 1372 | ||
1365 | void Rack::contentsMouseReleaseEvent(QMouseEvent* e) | 1373 | void Rack::contentsMouseReleaseEvent(QMouseEvent* /*e*/) |
1366 | { | 1374 | { |
1367 | if ( computerized() ) | 1375 | if ( computerized() ) |
1368 | return; | 1376 | return; |
1369 | if ( dragging ) { | 1377 | if ( dragging ) { |
1370 | dragging=0; | 1378 | dragging=0; |
1371 | layoutTiles(); | 1379 | layoutTiles(); |
1372 | } | 1380 | } |
1373 | } | 1381 | } |
1374 | 1382 | ||
1375 | Tile::Tile(const QString& key) | 1383 | Tile::Tile(const QString& key) |
1376 | { | 1384 | { |
1377 | int a=key.find('@'); | 1385 | int a=key.find('@'); |
1378 | txt = key.left(a); | 1386 | txt = key.left(a); |
1379 | val = key.mid(a+1).toInt(); | 1387 | val = key.mid(a+1).toInt(); |
1380 | blank = txt.isEmpty(); | 1388 | blank = txt.isEmpty(); |
1381 | } | 1389 | } |
1382 | 1390 | ||
1383 | QString Tile::key() const | 1391 | QString Tile::key() const |
1384 | { | 1392 | { |
1385 | return txt+"@"+QString::number(val); | 1393 | return txt+"@"+QString::number(val); |
1386 | } | 1394 | } |
1387 | 1395 | ||
1388 | Bag::Bag() | 1396 | Bag::Bag() |
1389 | { | 1397 | { |
1390 | tiles.setAutoDelete(TRUE); | 1398 | tiles.setAutoDelete(TRUE); |
1391 | } | 1399 | } |
1392 | 1400 | ||
1393 | void Bag::writeConfig(Config& cfg) | 1401 | void Bag::writeConfig(Config& cfg) |
1394 | { | 1402 | { |
1395 | QStringList t; | 1403 | QStringList t; |
1396 | for (QListIterator<Tile> it(tiles); it; ++it) | 1404 | for (QListIterator<Tile> it(tiles); it; ++it) |
1397 | t.append((*it)->key()); | 1405 | t.append((*it)->key()); |
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,94 +1,94 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | ballpainter.cpp - description | 2 | ballpainter.cpp - description |
3 | ------------------- | 3 | ------------------- |
4 | begin : Fri May 19 2000 | 4 | begin : Fri May 19 2000 |
5 | copyright : (C) 2000 by Roman Merzlyakov | 5 | copyright : (C) 2000 by Roman Merzlyakov |
6 | email : roman@sbrf.barrt.ru | 6 | email : roman@sbrf.barrt.ru |
7 | copyright : (C) 2000 by Roman Razilov | 7 | copyright : (C) 2000 by Roman Razilov |
8 | email : Roman.Razilov@gmx.de | 8 | email : Roman.Razilov@gmx.de |
9 | ***************************************************************************/ | 9 | ***************************************************************************/ |
10 | 10 | ||
11 | /*************************************************************************** | 11 | /*************************************************************************** |
12 | * * | 12 | * * |
13 | * This program is free software; you can redistribute it and/or modify * | 13 | * This program is free software; you can redistribute it and/or modify * |
14 | * it under the terms of the GNU General Public License as published by * | 14 | * it under the terms of the GNU General Public License as published by * |
15 | * the Free Software Foundation; either version 2 of the License, or * | 15 | * the Free Software Foundation; either version 2 of the License, or * |
16 | * (at your option) any later version. * | 16 | * (at your option) any later version. * |
17 | * * | 17 | * * |
18 | ***************************************************************************/ | 18 | ***************************************************************************/ |
19 | 19 | ||
20 | #include <qpe/resource.h> | 20 | #include <opie2/oresource.h> |
21 | 21 | ||
22 | #include "ballpainter.h" | 22 | #include "ballpainter.h" |
23 | //#include "shotcounter.h" | 23 | //#include "shotcounter.h" |
24 | #include <qpainter.h> | 24 | #include <qpainter.h> |
25 | //#include <qcolor.h> | 25 | //#include <qcolor.h> |
26 | 26 | ||
27 | 27 | ||
28 | #define PIXSIZE 21 | 28 | #define PIXSIZE 21 |
29 | 29 | ||
30 | int colorLinesArr[NCOLORS] = | 30 | int colorLinesArr[NCOLORS] = |
31 | {0x0000ff, 0x00ff00, 0xff0000, 0x00ffff, 0xff00ff, 0xffff00, 0x005080}; | 31 | {0x0000ff, 0x00ff00, 0xff0000, 0x00ffff, 0xff00ff, 0xffff00, 0x005080}; |
32 | // 0x00bbggrr | 32 | // 0x00bbggrr |
33 | // red , green , blue , yellow , violet , cyan , brown | 33 | // red , green , blue , yellow , violet , cyan , brown |
34 | 34 | ||
35 | 35 | ||
36 | 36 | ||
37 | BallPainter::BallPainter() | 37 | BallPainter::BallPainter() |
38 | : QObject() | 38 | : QObject() |
39 | { | 39 | { |
40 | createPixmap(); | 40 | createPixmap(); |
41 | } | 41 | } |
42 | 42 | ||
43 | BallPainter::~BallPainter() | 43 | BallPainter::~BallPainter() |
44 | { | 44 | { |
45 | } | 45 | } |
46 | 46 | ||
47 | QPixmap* BallPainter::pixmap( enum Pixmaps pix ) | 47 | QPixmap* BallPainter::pixmap( enum Pixmaps pix ) |
48 | { | 48 | { |
49 | QString name; | 49 | QString name; |
50 | switch(pix) { | 50 | switch(pix) { |
51 | case Field: | 51 | case Field: |
52 | name = QString::fromLatin1("zlines/field"); | 52 | name = QString::fromLatin1("zlines/field"); |
53 | break; | 53 | break; |
54 | case Balls: | 54 | case Balls: |
55 | name = QString::fromLatin1("zlines/balls"); | 55 | name = QString::fromLatin1("zlines/balls"); |
56 | break; | 56 | break; |
57 | case Fire: | 57 | case Fire: |
58 | name = QString::fromLatin1("zlines/fire"); | 58 | name = QString::fromLatin1("zlines/fire"); |
59 | break; | 59 | break; |
60 | } | 60 | } |
61 | 61 | ||
62 | return new QPixmap(Resource::loadPixmap(name) ); | 62 | return new QPixmap(Opie::Core::OResource::loadPixmap(name) ); |
63 | } | 63 | } |
64 | 64 | ||
65 | void BallPainter::createPixmap() | 65 | void BallPainter::createPixmap() |
66 | { | 66 | { |
67 | // warning( kapp->kde_datadir() +"/klines/data/balls.bmp"); | 67 | // warning( kapp->kde_datadir() +"/klines/data/balls.bmp"); |
68 | backgroundPix = pixmap(Field); | 68 | backgroundPix = pixmap(Field); |
69 | QPixmap *balls = pixmap(Balls); | 69 | QPixmap *balls = pixmap(Balls); |
70 | QPixmap *fire = pixmap(Fire); | 70 | QPixmap *fire = pixmap(Fire); |
71 | if (balls->isNull() ||backgroundPix->isNull() || fire->isNull() ) | 71 | if (balls->isNull() ||backgroundPix->isNull() || fire->isNull() ) |
72 | fatal("Cannot open data files.\nHave you correctly installed klines?"); | 72 | fatal("Cannot open data files.\nHave you correctly installed klines?"); |
73 | 73 | ||
74 | warning("Pixsize %i", PIXSIZE); | 74 | warning("Pixsize %i", PIXSIZE); |
75 | for(int c=0; c<NCOLORS; c++) | 75 | for(int c=0; c<NCOLORS; c++) |
76 | { | 76 | { |
77 | for(int t=0; t<PIXTIME + FIREBALLS + BOOMBALLS + 1 ; t++) | 77 | for(int t=0; t<PIXTIME + FIREBALLS + BOOMBALLS + 1 ; t++) |
78 | { | 78 | { |
79 | imgCash[c][t] = new QPixmap(CELLSIZE, CELLSIZE); | 79 | imgCash[c][t] = new QPixmap(CELLSIZE, CELLSIZE); |
80 | QPainter p(imgCash[c][t]); | 80 | QPainter p(imgCash[c][t]); |
81 | p.drawPixmap(0,0,(*backgroundPix),0,0,CELLSIZE,CELLSIZE); | 81 | p.drawPixmap(0,0,(*backgroundPix),0,0,CELLSIZE,CELLSIZE); |
82 | p.drawPixmap(1,1,(*balls),t*PIXSIZE,c*PIXSIZE,PIXSIZE,PIXSIZE); | 82 | p.drawPixmap(1,1,(*balls),t*PIXSIZE,c*PIXSIZE,PIXSIZE,PIXSIZE); |
83 | } | 83 | } |
84 | for(int t=0; t < FIREPIX ; t++) | 84 | for(int t=0; t < FIREPIX ; t++) |
85 | { | 85 | { |
86 | firePix[t] = new QPixmap(CELLSIZE, CELLSIZE); | 86 | firePix[t] = new QPixmap(CELLSIZE, CELLSIZE); |
87 | QPainter p(firePix[t]); | 87 | QPainter p(firePix[t]); |
88 | p.drawPixmap(0,0,(*backgroundPix),0,0,CELLSIZE,CELLSIZE); | 88 | p.drawPixmap(0,0,(*backgroundPix),0,0,CELLSIZE,CELLSIZE); |
89 | p.drawPixmap(1,1,(*fire),t*PIXSIZE,0,PIXSIZE,PIXSIZE); | 89 | p.drawPixmap(1,1,(*fire),t*PIXSIZE,0,PIXSIZE,PIXSIZE); |
90 | } | 90 | } |
91 | } | 91 | } |
92 | delete balls; | 92 | delete balls; |
93 | delete fire; | 93 | delete fire; |
94 | } | 94 | } |