summaryrefslogtreecommitdiff
path: root/noncore/games/tetrix/qtetrixb.h
Unidiff
Diffstat (limited to 'noncore/games/tetrix/qtetrixb.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/tetrix/qtetrixb.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/noncore/games/tetrix/qtetrixb.h b/noncore/games/tetrix/qtetrixb.h
new file mode 100644
index 0000000..4134a84
--- a/dev/null
+++ b/noncore/games/tetrix/qtetrixb.h
@@ -0,0 +1,80 @@
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 QTETRIXB_H
23#define QTETRIXB_H
24
25#include "gtetrix.h"
26#include <qframe.h>
27
28class QTimer;
29
30class QTetrixBoard : public QFrame, public GenericTetrix
31{
32 Q_OBJECT
33public:
34 QTetrixBoard( QWidget *parent=0, const char *name=0 );
35
36 void gameOver();
37 void startGame(int gameType = 0,int fillRandomLines = 0);
38
39public slots:
40 void timeout();
41 void updateNext(){ GenericTetrix::updateNext(); }
42 void key(QKeyEvent *e) { keyPressEvent(e); }
43 void start() { startGame(); }
44 void pause();
45
46signals:
47 void gameOverSignal();
48 void drawNextSquareSignal(int x,int y,QColor *color1);
49 void updateRemovedSignal(int noOfLines);
50 void updateScoreSignal(int score);
51 void updateLevelSignal(int level);
52
53public: // until we have keyboard focus, should be protected
54 void keyPressEvent( QKeyEvent * );
55
56private:
57 void drawContents( QPainter * );
58 void resizeEvent( QResizeEvent * );
59 void drawSquare(int x,int y,int value);
60 void drawNextSquare(int x,int y,int value);
61 void updateRemoved(int noOfLines);
62 void updateScore(int newScore);
63 void updateLevel(int newLlevel);
64 void pieceDropped(int dropHeight);
65 void updateTimeoutTime();
66
67 QTimer *timer;
68
69 int xOffset,yOffset;
70 int blockWidth,blockHeight;
71 int timeoutTime;
72 bool noGame;
73 bool isPaused;
74 bool waitingAfterLine;
75
76 QColor colors[7];
77 QPainter *paint;
78};
79
80#endif