home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_qt3.idb / usr / freeware / Qt / examples / demo / qasteroids / toplevel.h.z / toplevel.h
Encoding:
C/C++ Source or Header  |  2002-04-08  |  1.5 KB  |  80 lines

  1. /*
  2.  * KAsteroids - Copyright (c) Martin R. Jones 1997
  3.  *
  4.  * Part of the KDE project
  5.  */
  6.  
  7. #ifndef __KAST_TOPLEVEL_H__
  8. #define __KAST_TOPLEVEL_H__
  9.  
  10. #include <qmainwindow.h>
  11. #include <qdict.h>
  12. #include <qmap.h>
  13.  
  14. #include "view.h"
  15.  
  16.  
  17. class KALedMeter;
  18. class QLCDNumber;
  19.  
  20. class KAstTopLevel : public QMainWindow
  21. {
  22.     Q_OBJECT
  23. public:
  24.     KAstTopLevel( QWidget *parent=0, const char *name=0 );
  25.     virtual ~KAstTopLevel();
  26.  
  27. private:
  28.     void playSound( const char *snd );
  29.     void readSoundMapping();
  30.     void doStats();
  31.  
  32. protected:
  33.     virtual void showEvent( QShowEvent * );
  34.     virtual void hideEvent( QHideEvent * );
  35.     virtual void keyPressEvent( QKeyEvent *event );
  36.     virtual void keyReleaseEvent( QKeyEvent *event );
  37.  
  38. private slots:
  39.     void slotNewGame();
  40.  
  41.     void slotShipKilled();
  42.     void slotRockHit( int size );
  43.     void slotRocksRemoved();
  44.  
  45.     void slotUpdateVitals();
  46.  
  47. private:
  48.     KAsteroidsView *view;
  49.     QLCDNumber *scoreLCD;
  50.     QLCDNumber *levelLCD;
  51.     QLCDNumber *shipsLCD;
  52.  
  53.     QLCDNumber *teleportsLCD;
  54. //    QLCDNumber *bombsLCD;
  55.     QLCDNumber *brakesLCD;
  56.     QLCDNumber *shieldLCD;
  57.     QLCDNumber *shootLCD;
  58.     KALedMeter *powerMeter;
  59.  
  60.     bool   sound;
  61.     QDict<QString> soundDict;
  62.  
  63.     // waiting for user to press Enter to launch a ship
  64.     bool waitShip;
  65.     bool isPaused;
  66.  
  67.     int shipsRemain;
  68.     int score;
  69.     int level;
  70.     bool showHiscores;
  71.  
  72.     enum Action { Launch, Thrust, RotateLeft, RotateRight, Shoot, Teleport,
  73.                     Brake, Shield, Pause, NewGame  };
  74.  
  75.     QMap<int,Action> actions;
  76. };
  77.  
  78. #endif
  79.  
  80.