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

toplevel.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  * KAsteroids - Copyright (c) Martin R. Jones 1997
00021  *
00022  * Part of the KDE project
00023  */
00024 
00025 #ifndef __KAST_TOPLEVEL_H__
00026 #define __KAST_TOPLEVEL_H__
00027 
00028 #include <qmainwindow.h>
00029 #include <qdict.h>
00030 #include <qmap.h>
00031 
00032 #include "view.h"
00033 
00034 
00035 class KALedMeter;
00036 class QLCDNumber;
00037 
00038 class KAstTopLevel : public QMainWindow
00039 {
00040     Q_OBJECT
00041 public:
00042     KAstTopLevel( QWidget *parent=0, const char *name=0, WFlags fl = 0 );
00043     virtual ~KAstTopLevel();
00044     static QString appName() { return QString::fromLatin1("qasteroids"); }
00045 
00046 
00047 private:
00048     void playSound( const char *snd );
00049     void readSoundMapping();
00050     void doStats();
00051 
00052 protected:
00053     virtual void showEvent( QShowEvent * );
00054     virtual void hideEvent( QHideEvent * );
00055     virtual void keyPressEvent( QKeyEvent *event );
00056     virtual void keyReleaseEvent( QKeyEvent *event );
00057     virtual void focusInEvent( QFocusEvent *event );
00058     virtual void focusOutEvent( QFocusEvent *event );
00059 
00060 private slots:
00061     void slotNewGame();
00062 
00063     void slotShipKilled();
00064     void slotRockHit( int size );
00065     void slotRocksRemoved();
00066 
00067     void slotUpdateVitals();
00068 
00069 private:
00070     KAsteroidsView *view;
00071     QLCDNumber *scoreLCD;
00072     QLCDNumber *levelLCD;
00073     QLCDNumber *shipsLCD;
00074 
00075     QLCDNumber *teleportsLCD;
00076 //    QLCDNumber *bombsLCD;
00077     QLCDNumber *brakesLCD;
00078     QLCDNumber *shieldLCD;
00079     QLCDNumber *shootLCD;
00080     KALedMeter *powerMeter;
00081 
00082     bool   sound;
00083     QDict<QString> soundDict;
00084 
00085     // waiting for user to press Enter to launch a ship
00086     bool waitShip;
00087     bool isPaused;
00088 
00089     int shipsRemain;
00090     int score;
00091     int level;
00092     bool showHiscores;
00093 
00094     enum Action { Launch, Thrust, RotateLeft, RotateRight, Shoot, Teleport,
00095                     Brake, Shield, Pause, NewGame  };
00096 
00097     QMap<int,Action> actions;
00098 };
00099 
00100 #endif
00101 

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