summaryrefslogtreecommitdiff
path: root/noncore/games/snake
authorzecke <zecke>2004-02-06 12:14:56 (UTC)
committer zecke <zecke>2004-02-06 12:14:56 (UTC)
commit0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (unidiff)
tree3294663b92023f8d24d68a01022e011a3c94002d /noncore/games/snake
parent46ce5afcfbe7be19f4d5ac0fed6886a0759f1a25 (diff)
downloadopie-0c74629e8f5c12a9b5a282b817f884fa10dee491.zip
opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.gz
opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.bz2
Merge from the 1.0.x release
Diffstat (limited to 'noncore/games/snake') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/snake/interface.cpp2
-rw-r--r--noncore/games/snake/interface.h5
-rw-r--r--noncore/games/snake/main.cpp14
-rw-r--r--noncore/games/snake/opie-snake.control2
-rw-r--r--noncore/games/snake/snake.pro5
5 files changed, 13 insertions, 15 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
@@ -18,24 +18,26 @@
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
31SnakeGame::SnakeGame(QWidget* parent, const char* name, WFlags f) : 32SnakeGame::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);
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
@@ -15,12 +15,13 @@
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"
@@ -30,16 +31,18 @@
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();
diff --git a/noncore/games/snake/main.cpp b/noncore/games/snake/main.cpp
index 90a93b7..77a2769 100644
--- a/noncore/games/snake/main.cpp
+++ b/noncore/games/snake/main.cpp
@@ -14,22 +14,16 @@
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> 23#include <qpe/qpeapplication.h>
24#include <opie/oapplicationfactory.h>
25
24 26
27OPIE_EXPORT_APP( OApplicationFactory<SnakeGame> )
25 28
26int main(int argc, char **argv)
27{
28 QPEApplication app(argc,argv);
29 29
30 SnakeGame* m = new SnakeGame;
31 QPEApplication::setInputMethodHint( m, QPEApplication::AlwaysOff );
32 app.showMainWidget(m);
33
34 return app.exec();
35}
diff --git a/noncore/games/snake/opie-snake.control b/noncore/games/snake/opie-snake.control
index ef4fc61..f110acd 100644
--- a/noncore/games/snake/opie-snake.control
+++ b/noncore/games/snake/opie-snake.control
@@ -1,8 +1,8 @@
1Package: opie-snake 1Package: opie-snake
2Files: bin/snake apps/Games/snake.desktop pics/snake 2Files: plugins/application/libsnake.so* bin/snake apps/Games/snake.desktop pics/snake
3Priority: optional 3Priority: optional
4Section: opie/games 4Section: opie/games
5Maintainer: Martin Imobersteg <imm@gmx.ch> 5Maintainer: Martin Imobersteg <imm@gmx.ch>
6Architecture: arm 6Architecture: arm
7Depends: task-opie-minimal 7Depends: task-opie-minimal
8Description: Game: control the snake 8Description: Game: control the snake
diff --git a/noncore/games/snake/snake.pro b/noncore/games/snake/snake.pro
index 3da8631..2b7444c 100644
--- a/noncore/games/snake/snake.pro
+++ b/noncore/games/snake/snake.pro
@@ -1,11 +1,10 @@
1 TEMPLATE= app 1 CONFIG += qt warn_on release quick-app
2 CONFIG += qt warn_on release
3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = snake.h target.h obstacle.h interface.h codes.h 2 HEADERS = snake.h target.h obstacle.h interface.h codes.h
5 SOURCES = snake.cpp target.cpp obstacle.cpp interface.cpp main.cpp 3 SOURCES = snake.cpp target.cpp obstacle.cpp interface.cpp main.cpp
6 TARGET = snake 4 TARGET = snake
7INCLUDEPATH += $(OPIEDIR)/include 5INCLUDEPATH += $(OPIEDIR)/include
8 DEPENDPATH+= $(OPIEDIR)/include 6 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 7LIBS += -lqpe
10 8
9
11include ( $(OPIEDIR)/include.pro ) 10include ( $(OPIEDIR)/include.pro )