summaryrefslogtreecommitdiff
path: root/noncore/games/snake/interface.h
Unidiff
Diffstat (limited to 'noncore/games/snake/interface.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/snake/interface.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h
index 454d4ee..fa1dee4 100644
--- a/noncore/games/snake/interface.h
+++ b/noncore/games/snake/interface.h
@@ -1,63 +1,66 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qmainwindow.h> 20#include <qmainwindow.h>
21#include <qpe/qpeapplication.h>
21#include <qcanvas.h> 22#include <qcanvas.h>
22#include <qlabel.h> 23#include <qlabel.h>
23 24
24#include "snake.h" 25#include "snake.h"
25#include "target.h" 26#include "target.h"
26#include "obstacle.h" 27#include "obstacle.h"
27 28
28// class QCanvas; 29// class QCanvas;
29 30
30class SnakeGame : public QMainWindow { 31class SnakeGame : public QMainWindow {
31 Q_OBJECT 32 Q_OBJECT
32 33
33public: 34public:
34 SnakeGame(QWidget* parent=0, const char* name=0, WFlags f=0); 35 SnakeGame(QWidget* parent=0, const char* name=0, WFlags f=0);
35 ~SnakeGame(); 36 ~SnakeGame();
36 37
37 void clear(); 38 void clear();
38 void createTargets(); 39 void createTargets();
39 40
41 static QString appName() { return QString::fromLatin1("snake"); }
42
40protected: 43protected:
41 virtual void keyPressEvent(QKeyEvent*); 44 virtual void keyPressEvent(QKeyEvent*);
42 virtual void resizeEvent(QResizeEvent *e); 45 virtual void resizeEvent(QResizeEvent *e);
43 46
44signals: 47signals:
45 void moveFaster(); 48 void moveFaster();
46 49
47private slots: 50private slots:
48 void newGame(); 51 void newGame();
49 void gameOver(); 52 void gameOver();
50 void wait(); 53 void wait();
51 void levelUp(); 54 void levelUp();
52 void scoreInc(); 55 void scoreInc();
53 void welcomescreen(); 56 void welcomescreen();
54 57
55private: 58private:
56 void showScore(int); 59 void showScore(int);
57 QCanvasView* cv; 60 QCanvasView* cv;
58 QLabel* scorelabel; 61 QLabel* scorelabel;
59 QCanvas canvas; 62 QCanvas canvas;
60 QTimer* pauseTimer; 63 QTimer* pauseTimer;
61 Snake* snake; 64 Snake* snake;
62 int last; 65 int last;
63 int level; 66 int level;