Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qtetrix.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
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 //    void setScore( int score );
00066 //    void setLevel( int level );
00067 //    void setLines( int lines );
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

Generated on Sat Nov 5 16:17:27 2005 for OPIE by  doxygen 1.4.2