Diffstat (limited to 'noncore/games/backgammon/backgammon.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/backgammon/backgammon.h | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/noncore/games/backgammon/backgammon.h b/noncore/games/backgammon/backgammon.h new file mode 100644 index 0000000..40dbaba --- a/dev/null +++ b/noncore/games/backgammon/backgammon.h | |||
@@ -0,0 +1,134 @@ | |||
1 | #ifndef BACKGAMMON_H | ||
2 | #define BACKGAMMON_H | ||
3 | |||
4 | #include "canvasimageitem.h" | ||
5 | #include "definition.h" | ||
6 | //#include "rulesdialog.h" | ||
7 | #include "moveengine.h" | ||
8 | |||
9 | #include <qcanvas.h> | ||
10 | #include <qlabel.h> | ||
11 | #include <qlineedit.h> | ||
12 | #include <qwidget.h> | ||
13 | |||
14 | |||
15 | class BackGammonView : public QCanvasView | ||
16 | { | ||
17 | Q_OBJECT | ||
18 | public: | ||
19 | BackGammonView(QCanvas* canvas,QWidget* parent); | ||
20 | ~BackGammonView(); | ||
21 | signals: | ||
22 | void mouse(int,int); | ||
23 | private: | ||
24 | void contentsMousePressEvent(QMouseEvent* e); | ||
25 | }; | ||
26 | |||
27 | class BackGammon : public QWidget | ||
28 | { | ||
29 | Q_OBJECT | ||
30 | private: | ||
31 | //GUI | ||
32 | //is the style not qte ? | ||
33 | bool non_qte; | ||
34 | int offset; | ||
35 | //the "status" bar | ||
36 | QLineEdit* inputfield; | ||
37 | //the main drawing area | ||
38 | QCanvas* area; | ||
39 | BackGammonView* boardview; | ||
40 | CanvasImageItem* board; | ||
41 | CanvasImageItem* table; | ||
42 | CanvasImageItem** p1; | ||
43 | CanvasImageItem** p2; | ||
44 | CanvasImageItem** p1_side; | ||
45 | CanvasImageItem** p2_side; | ||
46 | |||
47 | CanvasImageItem** diceA1; | ||
48 | CanvasImageItem** diceA2; | ||
49 | CanvasImageItem** diceB1; | ||
50 | CanvasImageItem** diceB2; | ||
51 | //CanvasImageItem** oddsDice; | ||
52 | CanvasImageItem* nomove_marker; | ||
53 | |||
54 | QCanvasRectangle* marker_current; | ||
55 | QCanvasRectangle* marker_next[4]; | ||
56 | QLabel* message; | ||
57 | //ENGINE | ||
58 | MoveEngine* move; | ||
59 | //the dice values | ||
60 | int diceA1_value; | ||
61 | int diceA2_value; | ||
62 | int diceA3_value; | ||
63 | int diceA4_value; | ||
64 | int diceB1_value; | ||
65 | int diceB2_value; | ||
66 | int diceB3_value; | ||
67 | int diceB4_value; | ||
68 | |||
69 | int player; | ||
70 | bool dice1_played; | ||
71 | bool dice2_played; | ||
72 | bool dice3_played; | ||
73 | bool dice4_played; | ||
74 | bool dice_rolled; | ||
75 | //computer opponent | ||
76 | bool player1_auto; | ||
77 | bool player2_auto; | ||
78 | |||
79 | //the images; | ||
80 | QString theme_name; | ||
81 | QString board_name; | ||
82 | QString piecesA_name; | ||
83 | QString piecesB_name; | ||
84 | QString diceA_name; | ||
85 | QString diceB_name; | ||
86 | QString odds_name; | ||
87 | QString table_name; | ||
88 | |||
89 | //save game | ||
90 | QString game_name; | ||
91 | |||
92 | //the rules | ||
93 | Rules rules; | ||
94 | |||
95 | //display settings | ||
96 | Display display; | ||
97 | //is the game finished ? | ||
98 | bool gameFinished; | ||
99 | |||
100 | public: | ||
101 | BackGammon( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
102 | ~BackGammon(); | ||
103 | private slots: | ||
104 | void newgame(); | ||
105 | void playerselect(); | ||
106 | void loadgame(); | ||
107 | void savegame(); | ||
108 | void deletegame(); | ||
109 | void newtheme(); | ||
110 | void loadtheme(); | ||
111 | void savetheme(); | ||
112 | void themedefault(); | ||
113 | void deletetheme(); | ||
114 | void modify_AI(); | ||
115 | void setrules(); | ||
116 | void displaySettings(); | ||
117 | void mouse(int x,int y); | ||
118 | void done_dice1(); | ||
119 | void done_dice2(); | ||
120 | void done_dice3(); | ||
121 | void done_dice4(); | ||
122 | void nomove(); | ||
123 | void nomove2(); | ||
124 | void finished(int theplayer); | ||
125 | void autoroll_dice1(); | ||
126 | void autoroll_dice2(); | ||
127 | private: | ||
128 | void draw(); | ||
129 | void showdice(); | ||
130 | void setplayer(); | ||
131 | void applytheme(); | ||
132 | }; | ||
133 | |||
134 | #endif //BACKGAMMON_H | ||