summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp2
-rw-r--r--noncore/games/backgammon/backgammon.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 06523f1..db1a058 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -90,96 +90,98 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
90 theme.writeEntry("dice2","casino_dice"); 90 theme.writeEntry("dice2","casino_dice");
91 theme.writeEntry("table","casino_table_green"); 91 theme.writeEntry("table","casino_table_green");
92 theme.writeEntry("odds","casino_odds"); 92 theme.writeEntry("odds","casino_odds");
93 } 93 }
94 theme.setGroup("theme"); 94 theme.setGroup("theme");
95 board_name=theme.readEntry("board","casino_board_1"); 95 board_name=theme.readEntry("board","casino_board_1");
96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 96 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); 97 piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
98 diceA_name=theme.readEntry("dice1","casino_dice"); 98 diceA_name=theme.readEntry("dice1","casino_dice");
99 diceB_name=theme.readEntry("dice2","casino_dice"); 99 diceB_name=theme.readEntry("dice2","casino_dice");
100 table_name=theme.readEntry("table","casino_table_green"); 100 table_name=theme.readEntry("table","casino_table_green");
101 odds_name=theme.readEntry("odds","casino_odds"); 101 odds_name=theme.readEntry("odds","casino_odds");
102 102
103 103
104 //the menu 104 //the menu
105 QPEMenuBar* menuBar = new QPEMenuBar(this); 105 QPEMenuBar* menuBar = new QPEMenuBar(this);
106 106
107 QPopupMenu* gamemenu= new QPopupMenu(this); 107 QPopupMenu* gamemenu= new QPopupMenu(this);
108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame())); 108 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
109 gamemenu->insertSeparator(); 109 gamemenu->insertSeparator();
110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame())); 110 gamemenu->insertItem(tr( "Load" ),this,SLOT(loadgame()));
111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame())); 111 gamemenu->insertItem(tr( "Save" ),this,SLOT(savegame()));
112 gamemenu->insertSeparator(); 112 gamemenu->insertSeparator();
113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame())); 113 gamemenu->insertItem(tr( "Delete" ),this,SLOT(deletegame()));
114 menuBar->insertItem(tr( "Game" ),gamemenu); 114 menuBar->insertItem(tr( "Game" ),gamemenu);
115 115
116 QPopupMenu* thememenu= new QPopupMenu(this); 116 QPopupMenu* thememenu= new QPopupMenu(this);
117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme())); 117 thememenu->insertItem(tr( "New" ),this,SLOT(newtheme()));
118 thememenu->insertSeparator(); 118 thememenu->insertSeparator();
119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme())); 119 thememenu->insertItem(tr( "Load"),this,SLOT(loadtheme()));
120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme())); 120 thememenu->insertItem(tr( "Save" ),this,SLOT(savetheme()));
121 thememenu->insertSeparator(); 121 thememenu->insertSeparator();
122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault())); 122 thememenu->insertItem(tr( "Default"),this,SLOT(themedefault()));
123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme())); 123 thememenu->insertItem(tr( "Delete" ),this,SLOT(deletetheme()));
124 menuBar->insertItem(tr( "Theme" ),thememenu); 124 menuBar->insertItem(tr( "Theme" ),thememenu);
125 125
126 QPopupMenu* optionmenu=new QPopupMenu(this); 126 QPopupMenu* optionmenu=new QPopupMenu(this);
127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect())); 127 optionmenu->insertItem(tr( "Player" ),this,SLOT(playerselect()));
128 optionmenu->insertSeparator(); 128 optionmenu->insertSeparator();
129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI())); 129 optionmenu->insertItem(tr( "AI" ),this,SLOT(modify_AI()));
130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules())); 130 optionmenu->insertItem(tr( "Rules" ),this,SLOT(setrules()));
131 menuBar->insertItem(tr( "Options"),optionmenu); 131 menuBar->insertItem(tr( "Options"),optionmenu);
132 132
133 QWidget* mainarea=new QWidget(this); 133 QWidget* mainarea=new QWidget(this);
134 setCentralWidget(mainarea); 134 setCentralWidget(mainarea);
135 //the main area 135 //the main area
136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom); 136 QBoxLayout* layout=new QBoxLayout(mainarea,QBoxLayout::TopToBottom);
137 area=new QCanvas(235,235); 137 area=new QCanvas(235,235);
138 QColor bgColor=palette().color(QPalette::Normal,QColorGroup::Background);
139 area->setBackgroundColor(bgColor);
138 boardview=new BackGammonView(area,mainarea); 140 boardview=new BackGammonView(area,mainarea);
139 boardview->setMaximumHeight(240); 141 boardview->setMaximumHeight(240);
140 layout->addWidget(boardview); 142 layout->addWidget(boardview);
141 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int))); 143 connect(boardview,SIGNAL(mouse(int,int)),this,SLOT(mouse(int,int)));
142 //status bar 144 //status bar
143 message=new QLabel("<b>Backgammon</b>",mainarea); 145 message=new QLabel("<b>Backgammon</b>",mainarea);
144 message->setAlignment(AlignHCenter); 146 message->setAlignment(AlignHCenter);
145 layout->addWidget(message); 147 layout->addWidget(message);
146 148
147 //the marker 149 //the marker
148 marker_current=new QCanvasRectangle(area); 150 marker_current=new QCanvasRectangle(area);
149 marker_current->setBrush(QColor(0,0,255)); 151 marker_current->setBrush(QColor(0,0,255));
150 marker_current->setSize(15,5); 152 marker_current->setSize(15,5);
151 marker_current->setZ(1); 153 marker_current->setZ(1);
152 154
153 for(a=0;a<4;a++) 155 for(a=0;a<4;a++)
154 { 156 {
155 marker_next[a]=new QCanvasRectangle(area); 157 marker_next[a]=new QCanvasRectangle(area);
156 marker_next[a]->setBrush(QColor(0,255,0)); 158 marker_next[a]->setBrush(QColor(0,255,0));
157 marker_next[a]->setSize(15,5); 159 marker_next[a]->setSize(15,5);
158 marker_next[a]->setZ(1); 160 marker_next[a]->setZ(1);
159 } 161 }
160 162
161 connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1())); 163 connect(move,SIGNAL(done_dice1()),this,SLOT(done_dice1()));
162 connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2())); 164 connect(move,SIGNAL(done_dice2()),this,SLOT(done_dice2()));
163 connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3())); 165 connect(move,SIGNAL(done_dice3()),this,SLOT(done_dice3()));
164 connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4())); 166 connect(move,SIGNAL(done_dice4()),this,SLOT(done_dice4()));
165 connect(move,SIGNAL(nomove()),this,SLOT(nomove())); 167 connect(move,SIGNAL(nomove()),this,SLOT(nomove()));
166 connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int))); 168 connect(move,SIGNAL(player_finished(int)),this,SLOT(finished(int)));
167 169
168 //the pieces 170 //the pieces
169 p1=new CanvasImageItem*[15]; 171 p1=new CanvasImageItem*[15];
170 p1_side=new CanvasImageItem*[15]; 172 p1_side=new CanvasImageItem*[15];
171 QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name)); 173 QImage piece_1_all(Resource::loadImage("backgammon/pieces/"+piecesA_name));
172 QImage piece_1_front=piece_1_all.copy(0,0,15,15); 174 QImage piece_1_front=piece_1_all.copy(0,0,15,15);
173 QImage piece_1_side=piece_1_all.copy(0,15,15,5); 175 QImage piece_1_side=piece_1_all.copy(0,15,15,5);
174 176
175 p2=new CanvasImageItem*[15]; 177 p2=new CanvasImageItem*[15];
176 p2_side=new CanvasImageItem*[15]; 178 p2_side=new CanvasImageItem*[15];
177 QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name)); 179 QImage piece_2_all(Resource::loadImage("backgammon/pieces/"+piecesB_name));
178 QImage piece_2_front=piece_2_all.copy(0,0,15,15); 180 QImage piece_2_front=piece_2_all.copy(0,0,15,15);
179 QImage piece_2_side=piece_2_all.copy(0,15,15,5); 181 QImage piece_2_side=piece_2_all.copy(0,15,15,5);
180 182
181 183
182 for(a=0;a<15;a++) 184 for(a=0;a<15;a++)
183 { 185 {
184 p1[a]=new CanvasImageItem(piece_1_front,area); 186 p1[a]=new CanvasImageItem(piece_1_front,area);
185 p1[a]->setSize(15,15); 187 p1[a]->setSize(15,15);
diff --git a/noncore/games/backgammon/backgammon.h b/noncore/games/backgammon/backgammon.h
index e3276f1..d803489 100644
--- a/noncore/games/backgammon/backgammon.h
+++ b/noncore/games/backgammon/backgammon.h
@@ -1,69 +1,68 @@
1#ifndef BACKGAMMON_H 1#ifndef BACKGAMMON_H
2#define BACKGAMMON_H 2#define BACKGAMMON_H
3 3
4#include "backgammonview.h" 4#include "backgammonview.h"
5#include "canvasimageitem.h" 5#include "canvasimageitem.h"
6//#include "rulesdialog.h" 6//#include "rulesdialog.h"
7#include "moveengine.h" 7#include "moveengine.h"
8 8
9 9
10#include <qlabel.h> 10#include <qlabel.h>
11#include <qmainwindow.h> 11#include <qmainwindow.h>
12//#include <qwidget.h> 12//#include <qwidget.h>
13 13
14 14
15 15
16 16
17class BackGammon : public QMainWindow 17class BackGammon : public QMainWindow
18{ 18{
19 Q_OBJECT 19 Q_OBJECT
20private: 20private:
21 //GUI
22 //the "status" bar 21 //the "status" bar
23 QLabel* message; 22 QLabel* message;
24 //the main drawing area 23 //the main drawing area
25 QCanvas* area; 24 QCanvas* area;
26 BackGammonView* boardview; 25 BackGammonView* boardview;
27 CanvasImageItem* board; 26 CanvasImageItem* board;
28 CanvasImageItem* table; 27 CanvasImageItem* table;
29 CanvasImageItem** p1; 28 CanvasImageItem** p1;
30 CanvasImageItem** p2; 29 CanvasImageItem** p2;
31 CanvasImageItem** p1_side; 30 CanvasImageItem** p1_side;
32 CanvasImageItem** p2_side; 31 CanvasImageItem** p2_side;
33 32
34 CanvasImageItem** diceA1; 33 CanvasImageItem** diceA1;
35 CanvasImageItem** diceA2; 34 CanvasImageItem** diceA2;
36 CanvasImageItem** diceB1; 35 CanvasImageItem** diceB1;
37 CanvasImageItem** diceB2; 36 CanvasImageItem** diceB2;
38 //CanvasImageItem** oddsDice; 37 //CanvasImageItem** oddsDice;
39 CanvasImageItem* nomove_marker; 38 CanvasImageItem* nomove_marker;
40 39
41 QCanvasRectangle* marker_current; 40 QCanvasRectangle* marker_current;
42 QCanvasRectangle* marker_next[4]; 41 QCanvasRectangle* marker_next[4];
43 42
44 //ENGINE 43 //ENGINE
45 MoveEngine* move; 44 MoveEngine* move;
46 //the dice values 45 //the dice values
47 int diceA1_value; 46 int diceA1_value;
48 int diceA2_value; 47 int diceA2_value;
49 int diceA3_value; 48 int diceA3_value;
50 int diceA4_value; 49 int diceA4_value;
51 int diceB1_value; 50 int diceB1_value;
52 int diceB2_value; 51 int diceB2_value;
53 int diceB3_value; 52 int diceB3_value;
54 int diceB4_value; 53 int diceB4_value;
55 54
56 int player; 55 int player;
57 bool dice1_played; 56 bool dice1_played;
58 bool dice2_played; 57 bool dice2_played;
59 bool dice3_played; 58 bool dice3_played;
60 bool dice4_played; 59 bool dice4_played;
61 bool dice_rolled; 60 bool dice_rolled;
62 //computer opponent 61 //computer opponent
63 bool player1_auto; 62 bool player1_auto;
64 bool player2_auto; 63 bool player2_auto;
65 64
66 //the images; 65 //the images;
67 QString theme_name; 66 QString theme_name;
68 QString board_name; 67 QString board_name;
69 QString piecesA_name; 68 QString piecesA_name;