home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / examples / tetrix / qtetrix.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-11  |  1.7 KB  |  76 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qtetrix.h   3.0.0   edited Jun 22 13:24 $
  3. **
  4. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  5. **
  6. ** This file is part of an example program for Qt.  This example
  7. ** program may be used, distributed and modified without limitation.
  8. **
  9. *****************************************************************************/
  10.  
  11. #ifndef QTETRIX_H
  12. #define QTETRIX_H
  13.  
  14. #include "qtetrixb.h"
  15. #include <qframe.h>
  16. #include <qlcdnumber.h>
  17. #include <qlabel.h>
  18. #include <qpushbutton.h>
  19. #include <qpainter.h>
  20.  
  21.  
  22. class ShowNextPiece : public QFrame
  23. {
  24.     Q_OBJECT
  25.     friend class QTetrix;
  26. public:
  27.     ShowNextPiece( QWidget *parent=0, const char *name=0  );
  28. public slots:
  29.     void drawNextSquare( int x, int y,QColor *color );
  30. signals:
  31.     void update();
  32. private:
  33.     void paintEvent( QPaintEvent * );
  34.     void resizeEvent( QResizeEvent * );
  35.     
  36.     int      blockWidth,blockHeight;
  37.     int      xOffset,yOffset;
  38. };
  39.  
  40.  
  41. class QTetrix : public QWidget
  42. {
  43.     Q_OBJECT
  44. public:
  45.     QTetrix( QWidget *parent=0, const char *name=0 );
  46.     void startGame() { board->startGame(); }
  47.  
  48. public slots:
  49.     void gameOver();
  50.     void quit();
  51. private:
  52.     void keyPressEvent( QKeyEvent *e ) { board->keyPressEvent(e); }
  53.  
  54.     QTetrixBoard  *board;
  55.     ShowNextPiece *showNext;
  56. #ifndef QT_NO_LCDNUMBER
  57.     QLCDNumber    *showScore;
  58.     QLCDNumber    *showLevel;
  59.     QLCDNumber    *showLines;
  60. #else
  61.     QLabel    *showScore;
  62.     QLabel    *showLevel;
  63.     QLabel    *showLines;
  64. #endif
  65.     QPushButton   *quitButton;
  66.     QPushButton   *startButton;
  67.     QPushButton   *pauseButton;
  68. };
  69.  
  70.  
  71. void drawTetrixButton( QPainter *, int x, int y, int w, int h,
  72.                const QColor *color, QWidget *widg);
  73.  
  74.  
  75. #endif
  76.