00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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
00077 QLCDNumber *brakesLCD;
00078 QLCDNumber *shieldLCD;
00079 QLCDNumber *shootLCD;
00080 KALedMeter *powerMeter;
00081
00082 bool sound;
00083 QDict<QString> soundDict;
00084
00085
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