author | cniehaus <cniehaus> | 2003-08-12 16:09:37 (UTC) |
---|---|---|
committer | cniehaus <cniehaus> | 2003-08-12 16:09:37 (UTC) |
commit | d16aa943a04b1e630e913cc55789bb876cd0f42f (patch) (unidiff) | |
tree | 1f52c8cf40bbfaab318f7c62f4abbca73b58dfa3 /noncore/games/oyatzee/oyatzee.h | |
parent | e7f79ca3acf58aef3ff150a2974f8087189621f5 (diff) | |
download | opie-d16aa943a04b1e630e913cc55789bb876cd0f42f.zip opie-d16aa943a04b1e630e913cc55789bb876cd0f42f.tar.gz opie-d16aa943a04b1e630e913cc55789bb876cd0f42f.tar.bz2 |
A new Game: OYatzee. It is similar to Kniffel or Yatzee and not yet ready.
Diffstat (limited to 'noncore/games/oyatzee/oyatzee.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/oyatzee/oyatzee.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/noncore/games/oyatzee/oyatzee.h b/noncore/games/oyatzee/oyatzee.h new file mode 100644 index 0000000..7be9407 --- a/dev/null +++ b/noncore/games/oyatzee/oyatzee.h | |||
@@ -0,0 +1,96 @@ | |||
1 | #ifndef WORDGAME_H | ||
2 | #define WORDGAME_H | ||
3 | |||
4 | #include <qmainwindow.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <qlist.h> | ||
7 | |||
8 | #include <stdlib.h> // rand() function | ||
9 | #include <qdatetime.h> // seed for rand() | ||
10 | |||
11 | class Dice; | ||
12 | class Game; | ||
13 | class Scoreboard; | ||
14 | class DiceWidget; | ||
15 | |||
16 | typedef QList<Dice> dicesList; | ||
17 | |||
18 | class OYatzee : public QMainWindow { | ||
19 | Q_OBJECT | ||
20 | public: | ||
21 | OYatzee( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | ||
22 | ~OYatzee(); | ||
23 | |||
24 | Game *g; | ||
25 | DiceWidget *dw; | ||
26 | Scoreboard *sb; | ||
27 | |||
28 | |||
29 | void setPlayerNumber( const int num ); | ||
30 | void setRoundsNumber( const int num ); | ||
31 | |||
32 | public slots: | ||
33 | void slotStartGame(); | ||
34 | void slotRollDices(); | ||
35 | |||
36 | private: | ||
37 | int numOfPlayers; | ||
38 | int numOfRounds; | ||
39 | |||
40 | void detectPosibilities(); | ||
41 | }; | ||
42 | |||
43 | class Dice : public QFrame | ||
44 | { | ||
45 | Q_OBJECT | ||
46 | public: | ||
47 | Dice( QWidget* parent = 0, const char* name = 0 ); | ||
48 | |||
49 | int Value; | ||
50 | |||
51 | int hasValue(); | ||
52 | void roll(); | ||
53 | virtual void mousePressEvent( QMouseEvent* ); | ||
54 | |||
55 | private slots: | ||
56 | void slotSelected(); | ||
57 | |||
58 | signals: | ||
59 | void selected(); | ||
60 | |||
61 | protected: | ||
62 | void paintEvent( QPaintEvent *e ); | ||
63 | void paintNumber( QPainter *p ); | ||
64 | }; | ||
65 | |||
66 | class DiceWidget : public QWidget | ||
67 | { | ||
68 | Q_OBJECT | ||
69 | public: | ||
70 | DiceWidget( QWidget *parent = 0, const char* name = 0 ); | ||
71 | |||
72 | QPushButton *rollButton; | ||
73 | |||
74 | dicesList diceList; | ||
75 | }; | ||
76 | |||
77 | class Scoreboard : public QWidget | ||
78 | { | ||
79 | Q_OBJECT | ||
80 | public: | ||
81 | Scoreboard( QWidget *parent = 0, const char* name = 0 ); | ||
82 | |||
83 | protected: | ||
84 | void paintEvent( QPaintEvent *e ); | ||
85 | }; | ||
86 | |||
87 | class Player | ||
88 | { | ||
89 | public: | ||
90 | Player( QString name ); | ||
91 | |||
92 | QString playerName; | ||
93 | int totalPoints; | ||
94 | }; | ||
95 | |||
96 | #endif // WORDGAME_H | ||