00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef QTETRIX_H
00021 #define QTETRIX_H
00022
00023 #include "qtetrixb.h"
00024 #include <qframe.h>
00025 #include <qlcdnumber.h>
00026 #include <qpushbutton.h>
00027 #include <qpainter.h>
00028 #include <qmainwindow.h>
00029
00030 class QLabel;
00031
00032 class ShowNextPiece : public QFrame
00033 {
00034 Q_OBJECT
00035 friend class QTetrix;
00036 public:
00037 ShowNextPiece( QWidget *parent=0, const char *name=0 );
00038 public slots:
00039 void drawNextSquare( int x, int y,QColor *color );
00040 signals:
00041 void update();
00042 private:
00043 void paintEvent( QPaintEvent * );
00044 void resizeEvent( QResizeEvent * );
00045
00046 int blockWidth,blockHeight;
00047 int xOffset,yOffset;
00048 };
00049
00050
00051 class QTetrix : public QMainWindow
00052 {
00053 Q_OBJECT
00054 public:
00055 static QString appName() { return QString::fromLatin1("tetrix"); }
00056 QTetrix( QWidget *parent=0, const char *name=0, WFlags f=0 );
00057 void startGame() { board->startGame(); }
00058
00059 public slots:
00060 void setup();
00061 void gameOver();
00062 void quit();
00063
00064 void setNext( int x, int y, QColor *color );
00065
00066
00067
00068
00069 private:
00070 void keyPressEvent( QKeyEvent *e ) { board->keyPressEvent(e); }
00071 void resizeEvent( QResizeEvent * );
00072
00073 QTetrixBoard *board;
00074 ShowNextPiece *showNext;
00075 QLabel *showScore;
00076 QLabel *showLevel;
00077 QLabel *showLines;
00078 };
00079
00080
00081 void drawTetrixButton( QPainter *, int x, int y, int w, int h,
00082 const QColor *color );
00083
00084
00085 #endif