Diffstat (limited to 'noncore/games/snake/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/snake/interface.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/games/snake/interface.cpp b/noncore/games/snake/interface.cpp index f1227cb..2c60693 100644 --- a/noncore/games/snake/interface.cpp +++ b/noncore/games/snake/interface.cpp | |||
@@ -1,67 +1,69 @@ | |||
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> | ||
24 | 25 | ||
25 | #include <qpe/qpetoolbar.h> | 26 | #include <qpe/qpetoolbar.h> |
26 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
27 | #include <qstyle.h> | 28 | #include <qstyle.h> |
28 | #include <qapplication.h> | 29 | #include <qapplication.h> |
29 | #include <qmessagebox.h> | 30 | #include <qmessagebox.h> |
30 | 31 | ||
31 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : | 32 | SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : |
32 | QMainWindow(parent,name,f), | 33 | QMainWindow(parent,name,f), |
33 | canvas(232, 258) | 34 | canvas(232, 258) |
34 | { | 35 | { |
35 | setCaption( tr("Snake") ); | 36 | setCaption( tr("Snake") ); |
37 | QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); | ||
36 | QPixmap bg = Resource::loadPixmap("snake/grass"); | 38 | QPixmap bg = Resource::loadPixmap("snake/grass"); |
37 | canvas.setBackgroundPixmap(bg); | 39 | canvas.setBackgroundPixmap(bg); |
38 | canvas.setUpdatePeriod(100); | 40 | canvas.setUpdatePeriod(100); |
39 | snake = 0; | 41 | snake = 0; |
40 | 42 | ||
41 | cv = new QCanvasView(&canvas, this); | 43 | cv = new QCanvasView(&canvas, this); |
42 | 44 | ||
43 | pauseTimer = new QTimer(this); | 45 | pauseTimer = new QTimer(this); |
44 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); | 46 | connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) ); |
45 | 47 | ||
46 | setToolBarsMovable( FALSE ); | 48 | setToolBarsMovable( FALSE ); |
47 | 49 | ||
48 | QToolBar* toolbar = new QToolBar( this); | 50 | QToolBar* toolbar = new QToolBar( this); |
49 | toolbar->setHorizontalStretchable( TRUE ); | 51 | toolbar->setHorizontalStretchable( TRUE ); |
50 | 52 | ||
51 | QPixmap newicon = Resource::loadPixmap("ksnake"); | 53 | QPixmap newicon = Resource::loadPixmap("ksnake"); |
52 | setIcon(newicon); | 54 | setIcon(newicon); |
53 | (void)new QToolButton(newicon, tr("New Game"), 0, | 55 | (void)new QToolButton(newicon, tr("New Game"), 0, |
54 | this, SLOT(newGame()), toolbar, "New Game"); | 56 | this, SLOT(newGame()), toolbar, "New Game"); |
55 | 57 | ||
56 | scorelabel = new QLabel(toolbar); | 58 | scorelabel = new QLabel(toolbar); |
57 | showScore(0); | 59 | showScore(0); |
58 | scorelabel->setBackgroundMode( PaletteButton ); | 60 | scorelabel->setBackgroundMode( PaletteButton ); |
59 | scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); | 61 | scorelabel->setAlignment( AlignRight | AlignVCenter | ExpandTabs ); |
60 | toolbar->setStretchableWidget( scorelabel ); | 62 | toolbar->setStretchableWidget( scorelabel ); |
61 | 63 | ||
62 | setFocusPolicy(StrongFocus); | 64 | setFocusPolicy(StrongFocus); |
63 | 65 | ||
64 | setCentralWidget(cv); | 66 | setCentralWidget(cv); |
65 | 67 | ||
66 | QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); | 68 | QTimer::singleShot( 16, this, SLOT(welcomescreen()) ); |
67 | gamestopped = true; | 69 | gamestopped = true; |