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

qtetrixb.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 
00021 
00022 #ifndef QTETRIXB_H
00023 #define QTETRIXB_H
00024 
00025 #include "gtetrix.h"
00026 #include <qframe.h>
00027 
00028 class QTimer;
00029 
00030 class QTetrixBoard : public QFrame, public GenericTetrix
00031 {
00032     Q_OBJECT
00033 public:
00034     QTetrixBoard( QWidget *parent=0, const char *name=0 );
00035 
00036     void      gameOver();
00037     void      startGame(int gameType = 0,int fillRandomLines = 0);
00038 
00039 public slots:
00040     void      timeout();
00041     void      updateNext()      { GenericTetrix::updateNext(); }
00042     void      key(QKeyEvent *e) { keyPressEvent(e); }
00043     void      start()           { startGame(); }
00044     void      pause();
00045 
00046 signals:
00047     void      gameOverSignal();
00048     void      drawNextSquareSignal(int x,int y,QColor *color1);
00049     void      updateRemovedSignal(int noOfLines);
00050     void      updateScoreSignal(int score);
00051     void      updateLevelSignal(int level);
00052 
00053 public:       // until we have keyboard focus, should be protected
00054     void      keyPressEvent( QKeyEvent * );
00055 
00056 private:
00057     void      drawContents( QPainter * );
00058     void      resizeEvent( QResizeEvent * );
00059     void      drawSquare(int x,int y,int value);
00060     void      drawNextSquare(int x,int y,int value);
00061     void      updateRemoved(int noOfLines);
00062     void      updateScore(int newScore);
00063     void      updateLevel(int newLlevel);
00064     void      pieceDropped(int dropHeight);
00065     void      updateTimeoutTime();
00066 
00067     QTimer   *timer;
00068 
00069     int       xOffset,yOffset;
00070     int       blockWidth,blockHeight;
00071     int       timeoutTime;
00072     bool      noGame;
00073     bool      isPaused;
00074     bool      waitingAfterLine;
00075 
00076     QColor    colors[7];
00077     QPainter *paint;
00078 };
00079 
00080 #endif

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