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.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/noncore/games/snake/interface.h b/noncore/games/snake/interface.h
new file mode 100644
index 0000000..30c7f84
--- a/dev/null
+++ b/noncore/games/snake/interface.h
@@ -0,0 +1,69 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
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
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
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.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#include <qmainwindow.h>
21#include <qcanvas.h>
22#include <qlabel.h>
23
24#include "snake.h"
25#include "target.h"
26#include "obstacle.h"
27
28// class QCanvas;
29
30class SnakeGame : public QMainWindow {
31 Q_OBJECT
32
33public:
34 SnakeGame(QWidget* parent=0, const char* name=0, WFlags f=0);
35 ~SnakeGame();
36
37 void clear();
38 void createTargets();
39 void welcomescreen();
40
41protected:
42 virtual void keyPressEvent(QKeyEvent*);
43 virtual void resizeEvent(QResizeEvent *e);
44
45signals:
46 void moveFaster();
47
48private slots:
49 void newGame();
50 void gameOver();
51 void wait();
52 void levelUp();
53 void scoreInc();
54
55private:
56 void showScore(int);
57 QCanvasView* cv;
58 QLabel* scorelabel;
59 QCanvas canvas;
60 QTimer* pauseTimer;
61 Snake* snake;
62 int last;
63 int level;
64 int stage;
65 int targetamount;
66 int notargets;
67 bool waitover;
68 bool gamestopped;
69};