Diffstat (limited to 'noncore/games/snake/snake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/snake/snake.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/noncore/games/snake/snake.cpp b/noncore/games/snake/snake.cpp index 8a683ab..802951c 100644 --- a/noncore/games/snake/snake.cpp +++ b/noncore/games/snake/snake.cpp | |||
@@ -12,43 +12,42 @@ | |||
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 | 23 | ||
24 | #include <qpe/resource.h> | 24 | #include <opie2/oresource.h> |
25 | |||
26 | 25 | ||
27 | static int Piecekey[4][4] = { {6, 0, 4, 3 }, {0, 6, 2, 1 }, { 1, 3, 5, 0 }, {2, 4, 0, 5 } }; | 26 | static int Piecekey[4][4] = { {6, 0, 4, 3 }, {0, 6, 2, 1 }, { 1, 3, 5, 0 }, {2, 4, 0, 5 } }; |
28 | 27 | ||
29 | Snake::Snake(QCanvas* c) | 28 | Snake::Snake(QCanvas* c) |
30 | { | 29 | { |
31 | canvas = c; | 30 | canvas = c; |
32 | score = 0; | 31 | score = 0; |
33 | snakelist.setAutoDelete(true); | 32 | snakelist.setAutoDelete(true); |
34 | autoMoveTimer = new QTimer(this); | 33 | autoMoveTimer = new QTimer(this); |
35 | connect( autoMoveTimer, SIGNAL(timeout()), this, SLOT(moveSnake()) ); | 34 | connect( autoMoveTimer, SIGNAL(timeout()), this, SLOT(moveSnake()) ); |
36 | createSnake(); | 35 | createSnake(); |
37 | } | 36 | } |
38 | 37 | ||
39 | void Snake::createSnake() | 38 | void Snake::createSnake() |
40 | { | 39 | { |
41 | snakeparts = new QCanvasPixmapArray(); | 40 | snakeparts = new QCanvasPixmapArray(); |
42 | QString s0 = Resource::findPixmap("snake/s0001"); | 41 | QString s0 = Opie::Core::OResource::findPixmap("snake/s0001"); |
43 | s0.replace(QRegExp("0001"),"%1"); | 42 | s0.replace(QRegExp("0001"),"%1"); |
44 | snakeparts->readPixmaps(s0, 15); | 43 | snakeparts->readPixmaps(s0, 15); |
45 | 44 | ||
46 | grow = 0; | 45 | grow = 0; |
47 | last = Key_Right; | 46 | last = Key_Right; |
48 | 47 | ||
49 | QCanvasSprite* head = new QCanvasSprite(snakeparts, canvas ); | 48 | QCanvasSprite* head = new QCanvasSprite(snakeparts, canvas ); |
50 | head->setFrame(7); | 49 | head->setFrame(7); |
51 | snakelist.insert(0, head); | 50 | snakelist.insert(0, head); |
52 | head->show(); | 51 | head->show(); |
53 | head->move(34, 16); | 52 | head->move(34, 16); |
54 | 53 | ||