summaryrefslogtreecommitdiffstats
path: root/examples/tetrix/qtetrix.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tetrix/qtetrix.h')
-rw-r--r--examples/tetrix/qtetrix.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/examples/tetrix/qtetrix.h b/examples/tetrix/qtetrix.h
new file mode 100644
index 000000000..36d8bd041
--- /dev/null
+++ b/examples/tetrix/qtetrix.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of an example program for TQt. This example
+** program may be used, distributed and modified without limitation.
+**
+*****************************************************************************/
+
+#ifndef TQTETRIX_H
+#define TQTETRIX_H
+
+#include "qtetrixb.h"
+#include <qframe.h>
+#include <qlcdnumber.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qpainter.h>
+
+
+class ShowNextPiece : public TQFrame
+{
+ Q_OBJECT
+ friend class TQTetrix;
+public:
+ ShowNextPiece( TQWidget *parent=0, const char *name=0 );
+public slots:
+ void drawNextSquare( int x, int y,TQColor *color );
+signals:
+ void update();
+private:
+ void paintEvent( TQPaintEvent * );
+ void resizeEvent( TQResizeEvent * );
+
+ int blockWidth,blockHeight;
+ int xOffset,yOffset;
+};
+
+
+class TQTetrix : public TQWidget
+{
+ Q_OBJECT
+public:
+ TQTetrix( TQWidget *parent=0, const char *name=0 );
+ void startGame() { board->startGame(); }
+
+public slots:
+ void gameOver();
+ void tquit();
+private:
+ void keyPressEvent( TQKeyEvent *e ) { board->keyPressEvent(e); }
+
+ TQTetrixBoard *board;
+ ShowNextPiece *showNext;
+#ifndef QT_NO_LCDNUMBER
+ TQLCDNumber *showScore;
+ TQLCDNumber *showLevel;
+ TQLCDNumber *showLines;
+#else
+ TQLabel *showScore;
+ TQLabel *showLevel;
+ TQLabel *showLines;
+#endif
+ TQPushButton *tquitButton;
+ TQPushButton *startButton;
+ TQPushButton *pauseButton;
+};
+
+
+void drawTetrixButton( TQPainter *, int x, int y, int w, int h,
+ const TQColor *color, TQWidget *widg);
+
+
+#endif