home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / examples / demo / qasteroids / toplevel.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-03-16  |  1.6 KB  |  82 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.     virtual void focusInEvent( QFocusEvent *event );
  38.     virtual void focusOutEvent( QFocusEvent *event );
  39.  
  40. private slots:
  41.     void slotNewGame();
  42.  
  43.     void slotShipKilled();
  44.     void slotRockHit( int size );
  45.     void slotRocksRemoved();
  46.  
  47.     void slotUpdateVitals();
  48.  
  49. private:
  50.     KAsteroidsView *view;
  51.     QLCDNumber *scoreLCD;
  52.     QLCDNumber *levelLCD;
  53.     QLCDNumber *shipsLCD;
  54.  
  55.     QLCDNumber *teleportsLCD;
  56. //    QLCDNumber *bombsLCD;
  57.     QLCDNumber *brakesLCD;
  58.     QLCDNumber *shieldLCD;
  59.     QLCDNumber *shootLCD;
  60.     KALedMeter *powerMeter;
  61.  
  62.     bool   sound;
  63.     QDict<QString> soundDict;
  64.  
  65.     // waiting for user to press Enter to launch a ship
  66.     bool waitShip;
  67.     bool isPaused;
  68.  
  69.     int shipsRemain;
  70.     int score;
  71.     int level;
  72.     bool showHiscores;
  73.  
  74.     enum Action { Launch, Thrust, RotateLeft, RotateRight, Shoot, Teleport,
  75.                     Brake, Shield, Pause, NewGame  };
  76.  
  77.     QMap<int,Action> actions;
  78. };
  79.  
  80. #endif
  81.  
  82.