00001 /* 00002 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this program; if not, write to the Free 00016 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef KJEZZBALL_H_INCLUDED 00020 #define KJEZZBALL_H_INCLUDED 00021 00022 #include <qmainwindow.h> 00023 #include <qmenubar.h> 00024 #include <qlabel.h> 00025 00026 class JezzGame; 00027 class QLCDNumber; 00028 class QGridLayout; 00029 00030 class KJezzball : public QMainWindow 00031 { 00032 Q_OBJECT 00033 00034 public: 00035 static QString appName() { return QString::fromLatin1("bounce"); } 00036 KJezzball(QWidget *, const char*, WFlags ); 00037 00038 public slots: 00039 void newGame(); 00040 void pauseGame(); 00041 void closeGame(); 00042 void about(); 00043 00044 protected slots: 00045 void died(); 00046 void newPercent( int percent ); 00047 void second(); 00048 void switchLevel(); 00049 void gameOverNow(); 00050 00051 protected: 00052 void createLevel( int level ); 00053 void startLevel(); 00054 void stopLevel(); 00055 void nextLevel(); 00056 void gameOver(); 00057 void initXMLUI(); 00058 00059 void focusOutEvent( QFocusEvent * ); 00060 void focusInEvent ( QFocusEvent * ); 00061 void keyPressEvent( QKeyEvent *ev ); 00062 00063 JezzGame *m_gameWidget; 00064 QWidget *m_view; 00065 QGridLayout *m_layout; 00066 QLCDNumber *m_levelLCD; 00067 QLCDNumber *m_lifesLCD; 00068 QLCDNumber *m_scoreLCD; 00069 QLCDNumber *m_percentLCD; 00070 QLCDNumber *m_timeLCD; 00071 00072 QTimer *m_timer; 00073 QTimer *m_nextLevelTimer; 00074 QTimer *m_gameOverTimer; 00075 00076 enum { Idle, Running, Paused, Suspend } m_state; 00077 00078 struct 00079 { 00080 int lifes; 00081 int time; 00082 int score; 00083 } m_level; 00084 00085 struct 00086 { 00087 int level; 00088 int score; 00089 } m_game; 00090 private: 00091 QMenuBar *menu; 00092 QPopupMenu *game; 00093 QLabel* ScoreLabel; 00094 QLabel* LivesLabel; 00095 QLabel* FilledLabel; 00096 QLabel* TimeLabel; 00097 00098 }; 00099 00100 #endif
1.4.2