00001 #ifndef BACKGAMMON_H 00002 #define BACKGAMMON_H 00003 00004 #include "backgammonview.h" 00005 #include "canvasimageitem.h" 00006 //#include "rulesdialog.h" 00007 #include "moveengine.h" 00008 00009 00010 #include <qlabel.h> 00011 #include <qmainwindow.h> 00012 //#include <qwidget.h> 00013 00014 00015 00016 00017 class BackGammon : public QMainWindow 00018 { 00019 Q_OBJECT 00020 private: 00021 //GUI 00022 //the "status" bar 00023 QLabel* message; 00024 //the main drawing area 00025 QCanvas* area; 00026 BackGammonView* boardview; 00027 CanvasImageItem* board; 00028 CanvasImageItem* table; 00029 CanvasImageItem** p1; 00030 CanvasImageItem** p2; 00031 CanvasImageItem** p1_side; 00032 CanvasImageItem** p2_side; 00033 00034 CanvasImageItem** diceA1; 00035 CanvasImageItem** diceA2; 00036 CanvasImageItem** diceB1; 00037 CanvasImageItem** diceB2; 00038 //CanvasImageItem** oddsDice; 00039 CanvasImageItem* nomove_marker; 00040 00041 QCanvasRectangle* marker_current; 00042 QCanvasRectangle* marker_next[4]; 00043 00044 //ENGINE 00045 MoveEngine* move; 00046 //the dice values 00047 int diceA1_value; 00048 int diceA2_value; 00049 int diceA3_value; 00050 int diceA4_value; 00051 int diceB1_value; 00052 int diceB2_value; 00053 int diceB3_value; 00054 int diceB4_value; 00055 00056 int player; 00057 bool dice1_played; 00058 bool dice2_played; 00059 bool dice3_played; 00060 bool dice4_played; 00061 bool dice_rolled; 00062 //computer opponent 00063 bool player1_auto; 00064 bool player2_auto; 00065 00066 //the images; 00067 QString theme_name; 00068 QString board_name; 00069 QString piecesA_name; 00070 QString piecesB_name; 00071 QString diceA_name; 00072 QString diceB_name; 00073 QString odds_name; 00074 QString table_name; 00075 00076 //save game 00077 QString game_name; 00078 00079 //the rules 00080 Rules rules; 00081 00082 //display settings 00083 Display display; 00084 //is the game finished ? 00085 bool gameFinished; 00086 00087 public: 00088 static QString appName() { return QString::fromLatin1("backgammon"); } 00089 BackGammon( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 00090 ~BackGammon(); 00091 private slots: 00092 void newgame(); 00093 void playerselect(); 00094 void loadgame(); 00095 void savegame(); 00096 void deletegame(); 00097 void newtheme(); 00098 void loadtheme(); 00099 void savetheme(); 00100 void themedefault(); 00101 void deletetheme(); 00102 void modify_AI(); 00103 void setrules(); 00104 void mouse(int x,int y); 00105 void done_dice1(); 00106 void done_dice2(); 00107 void done_dice3(); 00108 void done_dice4(); 00109 void nomove(); 00110 void nomove2(); 00111 void finished(int theplayer); 00112 void autoroll_dice1(); 00113 void autoroll_dice2(); 00114 private: 00115 void draw(); 00116 void showdice(); 00117 void setplayer(); 00118 void applytheme(); 00119 }; 00120 00121 #endif //BACKGAMMON_H
1.4.2