00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef QTETRIXB_H
00023 #define QTETRIXB_H
00024
00025 #include "gtetrix.h"
00026 #include <qframe.h>
00027
00028 class QTimer;
00029
00030 class QTetrixBoard : public QFrame, public GenericTetrix
00031 {
00032 Q_OBJECT
00033 public:
00034 QTetrixBoard( QWidget *parent=0, const char *name=0 );
00035
00036 void gameOver();
00037 void startGame(int gameType = 0,int fillRandomLines = 0);
00038
00039 public slots:
00040 void timeout();
00041 void updateNext() { GenericTetrix::updateNext(); }
00042 void key(QKeyEvent *e) { keyPressEvent(e); }
00043 void start() { startGame(); }
00044 void pause();
00045
00046 signals:
00047 void gameOverSignal();
00048 void drawNextSquareSignal(int x,int y,QColor *color1);
00049 void updateRemovedSignal(int noOfLines);
00050 void updateScoreSignal(int score);
00051 void updateLevelSignal(int level);
00052
00053 public:
00054 void keyPressEvent( QKeyEvent * );
00055
00056 private:
00057 void drawContents( QPainter * );
00058 void resizeEvent( QResizeEvent * );
00059 void drawSquare(int x,int y,int value);
00060 void drawNextSquare(int x,int y,int value);
00061 void updateRemoved(int noOfLines);
00062 void updateScore(int newScore);
00063 void updateLevel(int newLlevel);
00064 void pieceDropped(int dropHeight);
00065 void updateTimeoutTime();
00066
00067 QTimer *timer;
00068
00069 int xOffset,yOffset;
00070 int blockWidth,blockHeight;
00071 int timeoutTime;
00072 bool noGame;
00073 bool isPaused;
00074 bool waitingAfterLine;
00075
00076 QColor colors[7];
00077 QPainter *paint;
00078 };
00079
00080 #endif