Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/backgammon.cpp | 34 |
1 files changed, 17 insertions, 17 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 | |||
@@ -4,15 +4,15 @@ | |||
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> |
@@ -24,13 +24,13 @@ using namespace Opie::Core; | |||
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 |
@@ -166,19 +166,19 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
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 | { |
@@ -192,19 +192,19 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
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); |
@@ -244,31 +244,31 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) | |||
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 | ||
@@ -921,23 +921,23 @@ 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 | { |
@@ -946,15 +946,15 @@ void BackGammon::applytheme() | |||
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); |