-rw-r--r-- | noncore/games/snake/interface.cpp | 4 | ||||
-rw-r--r-- | noncore/games/snake/main.cpp | 1 | ||||
-rw-r--r-- | noncore/games/snake/snake.cpp | 2 |
3 files changed, 0 insertions, 7 deletions
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp index 2c60693..b5fb5bf 100644 --- a/noncore/games/snake/interface.cpp +++ b/noncore/games/snake/interface.cpp | |||
@@ -1,54 +1,50 @@ | |||
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 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | 22 | ||
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
24 | #include <qpe/qpeapplication.h> | ||
25 | 24 | ||
26 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
27 | #include <qtoolbutton.h> | 26 | #include <qtoolbutton.h> |
28 | #include <qstyle.h> | ||
29 | #include <qapplication.h> | ||
30 | #include <qmessagebox.h> | ||
31 | 27 | ||
32 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : | 28 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : |
33 | QMainWindow(parent,name,f), | 29 | QMainWindow(parent,name,f), |
34 | canvas(232, 258) | 30 | canvas(232, 258) |
35 | { | 31 | { |
36 | setCaption( tr("Snake") ); | 32 | setCaption( tr("Snake") ); |
37 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | 33 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); |
38 | QPixmap bg = Resource::loadPixmap("snake/grass"); | 34 | QPixmap bg = Resource::loadPixmap("snake/grass"); |
39 | canvas.setBackgroundPixmap(bg); | 35 | canvas.setBackgroundPixmap(bg); |
40 | canvas.setUpdatePeriod(100); | 36 | canvas.setUpdatePeriod(100); |
41 | snake = 0; | 37 | snake = 0; |
42 | 38 | ||
43 | cv = new QCanvasView(&canvas, this); | 39 | cv = new QCanvasView(&canvas, this); |
44 | 40 | ||
45 | pauseTimer = new QTimer(this); | 41 | pauseTimer = new QTimer(this); |
46 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); | 42 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); |
47 | 43 | ||
48 | setToolBarsMovable( FALSE ); | 44 | setToolBarsMovable( FALSE ); |
49 | 45 | ||
50 | QToolBar* toolbar = new QToolBar( this); | 46 | QToolBar* toolbar = new QToolBar( this); |
51 | toolbar->setHorizontalStretchable( TRUE ); | 47 | toolbar->setHorizontalStretchable( TRUE ); |
52 | 48 | ||
53 | QPixmap newicon = Resource::loadPixmap("ksnake"); | 49 | QPixmap newicon = Resource::loadPixmap("ksnake"); |
54 | setIcon(newicon); | 50 | setIcon(newicon); |
diff --git a/noncore/games/snake/main.cpp b/noncore/games/snake/main.cpp index 77a2769..9a9b167 100644 --- a/noncore/games/snake/main.cpp +++ b/noncore/games/snake/main.cpp | |||
@@ -1,29 +1,28 @@ | |||
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 | 20 | ||
21 | #include "interface.h" | 21 | #include "interface.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | #include <opie/oapplicationfactory.h> | 23 | #include <opie/oapplicationfactory.h> |
25 | 24 | ||
26 | 25 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> ) | 26 | OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> ) |
28 | 27 | ||
29 | 28 | ||
diff --git a/noncore/games/snake/snake.cpp b/noncore/games/snake/snake.cpp index 9f19841..8a683ab 100644 --- a/noncore/games/snake/snake.cpp +++ b/noncore/games/snake/snake.cpp | |||
@@ -1,51 +1,49 @@ | |||
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 | 20 | ||
21 | #include "snake.h" | 21 | #include "snake.h" |
22 | #include "target.h" | 22 | #include "target.h" |
23 | #include "codes.h" | ||
24 | 23 | ||
25 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
26 | 25 | ||
27 | #include <qregexp.h> | ||
28 | 26 | ||
29 | static int Piecekey[4][4] = { {6, 0, 4, 3 }, {0, 6, 2, 1 }, { 1, 3, 5, 0 }, {2, 4, 0, 5 } }; | 27 | static int Piecekey[4][4] = { {6, 0, 4, 3 }, {0, 6, 2, 1 }, { 1, 3, 5, 0 }, {2, 4, 0, 5 } }; |
30 | 28 | ||
31 | Snake::Snake(QCanvas* c) | 29 | Snake::Snake(QCanvas* c) |
32 | { | 30 | { |
33 | canvas = c; | 31 | canvas = c; |
34 | score = 0; | 32 | score = 0; |
35 | snakelist.setAutoDelete(true); | 33 | snakelist.setAutoDelete(true); |
36 | autoMoveTimer = new QTimer(this); | 34 | autoMoveTimer = new QTimer(this); |
37 | connect( autoMoveTimer, SIGNAL(timeout()), this, SLOT(moveSnake()) ); | 35 | connect( autoMoveTimer, SIGNAL(timeout()), this, SLOT(moveSnake()) ); |
38 | createSnake(); | 36 | createSnake(); |
39 | } | 37 | } |
40 | 38 | ||
41 | void Snake::createSnake() | 39 | void Snake::createSnake() |
42 | { | 40 | { |
43 | snakeparts = new QCanvasPixmapArray(); | 41 | snakeparts = new QCanvasPixmapArray(); |
44 | QString s0 = Resource::findPixmap("snake/s0001"); | 42 | QString s0 = Resource::findPixmap("snake/s0001"); |
45 | s0.replace(QRegExp("0001"),"%1"); | 43 | s0.replace(QRegExp("0001"),"%1"); |
46 | snakeparts->readPixmaps(s0, 15); | 44 | snakeparts->readPixmaps(s0, 15); |
47 | 45 | ||
48 | grow = 0; | 46 | grow = 0; |
49 | last = Key_Right; | 47 | last = Key_Right; |
50 | 48 | ||
51 | QCanvasSprite* head = new QCanvasSprite(snakeparts, canvas ); | 49 | QCanvasSprite* head = new QCanvasSprite(snakeparts, canvas ); |