00001 /********************************************************************** 00002 ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. 00003 ** 00004 ** This file is part of the 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 #include "cannon.h" 00022 #include "base.h" 00023 #include "helicopter.h" 00024 00025 #include <qtopia/sound.h> 00026 00027 #include <qmainwindow.h> 00028 #include <qtimer.h> 00029 #include <qlabel.h> 00030 00031 class QCanvas; 00032 class Helicopter; 00033 00034 //enum Direction{ 00035 // left, right, up, down }; 00036 00037 class ParaShoot : public QMainWindow { 00038 Q_OBJECT 00039 00040 public: 00041 ParaShoot(QWidget* parent=0, const char* name=0, WFlags f=0); 00042 static QString appName() { 00043 return QString::fromLatin1("parashoot"); 00044 } 00045 void clear(); 00046 void gameOver(); 00047 int mancount; 00048 void levelUp(); 00049 void moveFaster(); 00050 00051 protected: 00052 virtual void keyPressEvent(QKeyEvent*); 00053 virtual void keyReleaseEvent(QKeyEvent*); 00054 virtual void resizeEvent(QResizeEvent *e); 00055 virtual void focusOutEvent(QFocusEvent *); 00056 virtual void focusInEvent(QFocusEvent *); 00057 00058 private slots: 00059 void increaseScore(int); 00060 void newGame(); 00061 void play(); 00062 void wait(); 00063 00064 private: 00065 void showScore( int score, int level ); 00066 QCanvasView* pb; 00067 QCanvas canvas; 00068 Cannon* cannon; 00069 Base* base; 00070 QLabel* levelscore; 00071 int nomen; 00072 int level; 00073 int oldscore; 00074 int updatespeed; 00075 QTimer* autoDropTimer; 00076 QTimer* pauseTimer; 00077 bool gamestopped; 00078 bool waitover; 00079 Sound fanfare; 00080 int score; 00081 int lastcannonkey; 00082 };
1.4.2