source: trunk/examples/tetrix/qtetrix.h@ 164

Last change on this file since 164 was 160, checked in by dmik, 19 years ago

Imported table and iconview modules and a bunch of dependent examples from the official release 3.3.1 from Trolltech.

  • Property svn:keywords set to Id
File size: 1.7 KB
Line 
1/****************************************************************************
2** $Id: qtetrix.h 160 2006-12-11 20:15:57Z dmik $
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
22class ShowNextPiece : public QFrame
23{
24 Q_OBJECT
25 friend class QTetrix;
26public:
27 ShowNextPiece( QWidget *parent=0, const char *name=0 );
28public slots:
29 void drawNextSquare( int x, int y,QColor *color );
30signals:
31 void update();
32private:
33 void paintEvent( QPaintEvent * );
34 void resizeEvent( QResizeEvent * );
35
36 int blockWidth,blockHeight;
37 int xOffset,yOffset;
38};
39
40
41class QTetrix : public QWidget
42{
43 Q_OBJECT
44public:
45 QTetrix( QWidget *parent=0, const char *name=0 );
46 void startGame() { board->startGame(); }
47
48public slots:
49 void gameOver();
50 void quit();
51private:
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
71void drawTetrixButton( QPainter *, int x, int y, int w, int h,
72 const QColor *color, QWidget *widg);
73
74
75#endif
Note: See TracBrowser for help on using the repository browser.