Diffstat (limited to 'noncore/games/tetrix/qtetrix.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/tetrix/qtetrix.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/noncore/games/tetrix/qtetrix.h b/noncore/games/tetrix/qtetrix.h new file mode 100644 index 0000000..b6e058a --- a/dev/null +++ b/noncore/games/tetrix/qtetrix.h | |||
@@ -0,0 +1,78 @@ | |||
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 | |||
22 | #ifndef QTETRIX_H | ||
23 | #define QTETRIX_H | ||
24 | |||
25 | #include "qtetrixb.h" | ||
26 | #include <qframe.h> | ||
27 | #include <qlcdnumber.h> | ||
28 | #include <qpushbutton.h> | ||
29 | #include <qpainter.h> | ||
30 | #include <qmainwindow.h> | ||
31 | |||
32 | class QLabel; | ||
33 | |||
34 | class ShowNextPiece : public QFrame | ||
35 | { | ||
36 | Q_OBJECT | ||
37 | friend class QTetrix; | ||
38 | public: | ||
39 | ShowNextPiece( QWidget *parent=0, const char *name=0 ); | ||
40 | public slots: | ||
41 | void drawNextSquare( int x, int y,QColor *color ); | ||
42 | signals: | ||
43 | void update(); | ||
44 | private: | ||
45 | void paintEvent( QPaintEvent * ); | ||
46 | void resizeEvent( QResizeEvent * ); | ||
47 | |||
48 | int blockWidth,blockHeight; | ||
49 | int xOffset,yOffset; | ||
50 | }; | ||
51 | |||
52 | |||
53 | class QTetrix : public QMainWindow | ||
54 | { | ||
55 | Q_OBJECT | ||
56 | public: | ||
57 | QTetrix( QWidget *parent=0, const char *name=0, WFlags f=0 ); | ||
58 | void startGame() { board->startGame(); } | ||
59 | |||
60 | public slots: | ||
61 | void gameOver(); | ||
62 | void quit(); | ||
63 | private: | ||
64 | void keyPressEvent( QKeyEvent *e ) { board->keyPressEvent(e); } | ||
65 | |||
66 | QTetrixBoard *board; | ||
67 | ShowNextPiece *showNext; | ||
68 | QLabel *showScore; | ||
69 | QLabel *showLevel; | ||
70 | QLabel *showLines; | ||
71 | }; | ||
72 | |||
73 | |||
74 | void drawTetrixButton( QPainter *, int x, int y, int w, int h, | ||
75 | const QColor *color ); | ||
76 | |||
77 | |||
78 | #endif | ||