summaryrefslogtreecommitdiff
path: root/noncore/games/mindbreaker/mindbreaker.h
authorkergoth <kergoth>2002-01-25 22:14:26 (UTC)
committer kergoth <kergoth>2002-01-25 22:14:26 (UTC)
commit15318cad33835e4e2dc620d033e43cd930676cdd (patch) (unidiff)
treec2fa0399a2c47fda8e2cd0092c73a809d17f68eb /noncore/games/mindbreaker/mindbreaker.h
downloadopie-15318cad33835e4e2dc620d033e43cd930676cdd.zip
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.gz
opie-15318cad33835e4e2dc620d033e43cd930676cdd.tar.bz2
Initial revision
Diffstat (limited to 'noncore/games/mindbreaker/mindbreaker.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/mindbreaker/mindbreaker.h122
1 files changed, 122 insertions, 0 deletions
diff --git a/noncore/games/mindbreaker/mindbreaker.h b/noncore/games/mindbreaker/mindbreaker.h
new file mode 100644
index 0000000..fca649a
--- a/dev/null
+++ b/noncore/games/mindbreaker/mindbreaker.h
@@ -0,0 +1,122 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#ifndef MINDBREAKER_H
22#define MINDBREAKER_H
23
24#include <qwidget.h>
25#include <qmainwindow.h>
26#include <qimage.h>
27#include <qvector.h>
28#include <qcanvas.h>
29#include <qlabel.h>
30
31static const int panel_height = 26;
32static const int panel_width = 180;
33
34static const int title_height = 25;
35static const int title_width = 180;
36
37static const int bin_margin = 10;
38static const int peg_size = 20;
39static const int answerpeg_size = 13;
40
41static const int first_peg_x_diff = 21;
42static const int first_peg_y_diff = ((panel_height - peg_size) >> 1);
43static const int peg_spacing = 30;
44
45static const int answerpegx = 152;
46static const int answerpegy = 2;
47static const int answerpeg_diff = 9;
48
49static const int board_height = (title_height + (panel_height * 9));
50static const int board_width = (panel_width + (bin_margin * 2) + peg_size);
51
52class Peg;
53class QToolButton;
54
55class MindBreakerBoard : public QCanvasView // QWidget
56{
57 Q_OBJECT
58public:
59 MindBreakerBoard(QCanvas &c, QWidget *parent=0, const char *name=0, int wFlags=0 );
60 ~MindBreakerBoard();
61
62 void getScore(int *, int *);
63signals:
64 void scoreChanged(int, int);
65
66public slots:
67 void clear();
68 void resetScore();
69
70protected:
71 void contentsMousePressEvent(QMouseEvent *);
72 void contentsMouseMoveEvent(QMouseEvent *);
73 void contentsMouseReleaseEvent(QMouseEvent *);
74 void resizeEvent(QResizeEvent *);
75
76private:
77 void drawBackground();
78 void checkGuess();
79 void checkScores();
80 void placeGuessPeg(int pos, int pegId);
81
82 QImage panelImage;
83 QImage titleImage;
84
85 Peg *moving;
86 Peg *current_highlight;
87 QPoint moving_pos;
88
89 // the game stuff
90 int answer[4];
91 int current_guess[4];
92 int past_guesses[4*9];
93 int current_go;
94
95 int null_press;
96 QPoint null_point;
97 bool copy_press;
98 Peg *copy_peg;
99 bool game_over;
100
101 int total_turns;
102 int total_games;
103};
104
105class MindBreaker : public QMainWindow // QWidget
106{
107 Q_OBJECT
108public:
109 MindBreaker(QWidget *parent=0, const char *name=0, int wFlags=0 );
110
111public slots:
112 void setScore(int, int);
113
114private:
115 QCanvas canvas;
116 MindBreakerBoard *board;
117 QToolButton *score;
118
119};
120
121
122#endif