author | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-06 12:14:56 (UTC) |
commit | 0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (unidiff) | |
tree | 3294663b92023f8d24d68a01022e011a3c94002d /noncore/games/qasteroids | |
parent | 46ce5afcfbe7be19f4d5ac0fed6886a0759f1a25 (diff) | |
download | opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.zip opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.gz opie-0c74629e8f5c12a9b5a282b817f884fa10dee491.tar.bz2 |
Merge from the 1.0.x release
-rw-r--r-- | noncore/games/qasteroids/main.cpp | 13 | ||||
-rw-r--r-- | noncore/games/qasteroids/opie-qasteroids.control | 2 | ||||
-rw-r--r-- | noncore/games/qasteroids/qasteroids.pro | 6 | ||||
-rw-r--r-- | noncore/games/qasteroids/toplevel.cpp | 19 | ||||
-rw-r--r-- | noncore/games/qasteroids/toplevel.h | 4 |
5 files changed, 20 insertions, 24 deletions
diff --git a/noncore/games/qasteroids/main.cpp b/noncore/games/qasteroids/main.cpp index 7d1682c..c762990 100644 --- a/noncore/games/qasteroids/main.cpp +++ b/noncore/games/qasteroids/main.cpp | |||
@@ -12,25 +12,16 @@ | |||
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 "toplevel.h" | 21 | #include "toplevel.h" |
22 | 22 | ||
23 | #include <qpe/qpeapplication.h> | 23 | #include <qpe/qpeapplication.h> |
24 | #include <opie/oapplicationfactory.h> | ||
24 | 25 | ||
25 | int main( int argc, char *argv[] ) | ||
26 | { | ||
27 | QPEApplication app( argc, argv ); | ||
28 | |||
29 | QPEApplication::grabKeyboard(); | ||
30 | |||
31 | KAstTopLevel *mainWidget = new KAstTopLevel(); | ||
32 | app.showMainWidget( mainWidget ); | ||
33 | |||
34 | app.exec(); | ||
35 | } | ||
36 | 26 | ||
27 | OPIE_EXPORT_APP( OApplicationFactory<KAstTopLevel> ) | ||
diff --git a/noncore/games/qasteroids/opie-qasteroids.control b/noncore/games/qasteroids/opie-qasteroids.control index 25a49b4..8764578 100644 --- a/noncore/games/qasteroids/opie-qasteroids.control +++ b/noncore/games/qasteroids/opie-qasteroids.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-qasteroids | 1 | Package: opie-qasteroids |
2 | Files: bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/* | 2 | Files: plugins/application/libqasteroids.so* bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/games | 4 | Section: opie/games |
5 | Maintainer: Martin Jones <mjones@trolltech.com> | 5 | Maintainer: Martin Jones <mjones@trolltech.com> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Depends: task-opie-minimal | 7 | Depends: task-opie-minimal |
8 | Description: Game: shoot the asteroids | 8 | Description: Game: shoot the asteroids |
9 | A game for the Opie environment. | 9 | A game for the Opie environment. |
10 | Version: $QPE_VERSION$EXTRAVERSION | 10 | Version: $QPE_VERSION$EXTRAVERSION |
diff --git a/noncore/games/qasteroids/qasteroids.pro b/noncore/games/qasteroids/qasteroids.pro index 1a3a8d5..aafc701 100644 --- a/noncore/games/qasteroids/qasteroids.pro +++ b/noncore/games/qasteroids/qasteroids.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE= app | 1 | CONFIG += qt warn_on release quick-app |
2 | CONFIG += qt warn_on release | ||
3 | DESTDIR = $(OPIEDIR)/bin | ||
4 | HEADERS = ledmeter.h sprites.h toplevel.h view.h | 2 | HEADERS = ledmeter.h sprites.h toplevel.h view.h |
5 | SOURCES = ledmeter.cpp toplevel.cpp view.cpp main.cpp | 3 | SOURCES = ledmeter.cpp toplevel.cpp view.cpp main.cpp |
6 | TARGET = qasteroids | 4 | TARGET = qasteroids |
7 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
8 | DEPENDPATH+= $(OPIEDIR)/include | 6 | DEPENDPATH+= $(OPIEDIR)/include |
9 | LIBS += -lqpe | 7 | LIBS += -lqpe |
10 | 8 | ||
9 | |||
10 | |||
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/games/qasteroids/toplevel.cpp b/noncore/games/qasteroids/toplevel.cpp index 71daf60..c4fea89 100644 --- a/noncore/games/qasteroids/toplevel.cpp +++ b/noncore/games/qasteroids/toplevel.cpp | |||
@@ -60,49 +60,52 @@ SLevel levels[MAX_LEVELS] = | |||
60 | { 3, 0.6 }, | 60 | { 3, 0.6 }, |
61 | { 3, 0.7 }, | 61 | { 3, 0.7 }, |
62 | { 3, 0.8 }, | 62 | { 3, 0.8 }, |
63 | { 4, 0.6 }, | 63 | { 4, 0.6 }, |
64 | { 4, 0.7 }, | 64 | { 4, 0.7 }, |
65 | { 4, 0.8 }, | 65 | { 4, 0.8 }, |
66 | { 5, 0.7 }, | 66 | { 5, 0.7 }, |
67 | { 5, 0.8 }, | 67 | { 5, 0.8 }, |
68 | { 5, 0.9 }, | 68 | { 5, 0.9 }, |
69 | { 5, 1.0 } | 69 | { 5, 1.0 } |
70 | }; | 70 | }; |
71 | 71 | ||
72 | const char *soundEvents[] = | 72 | const char *soundEvents[] = |
73 | { | 73 | { |
74 | "ShipDestroyed", | 74 | "ShipDestroyed", |
75 | "RockDestroyed", | 75 | "RockDestroyed", |
76 | 0 | 76 | 0 |
77 | }; | 77 | }; |
78 | 78 | ||
79 | const char *soundDefaults[] = | 79 | const char *soundDefaults[] = |
80 | { | 80 | { |
81 | "Explosion.wav", | 81 | "Explosion.wav", |
82 | "ploop.wav", | 82 | "ploop.wav", |
83 | 0 | 83 | 0 |
84 | }; | 84 | }; |
85 | 85 | ||
86 | 86 | ||
87 | KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name ) | 87 | KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name, WFlags fl ) |
88 | : QMainWindow( parent, _name ) | 88 | : QMainWindow( parent, _name, fl ) |
89 | { | 89 | { |
90 | setCaption( tr("Asteroids") ); | 90 | setCaption( tr("Asteroids") ); |
91 | |||
92 | QPEApplication::grabKeyboard(); | ||
93 | |||
91 | QWidget *border = new QWidget( this ); | 94 | QWidget *border = new QWidget( this ); |
92 | border->setBackgroundColor( black ); | 95 | border->setBackgroundColor( black ); |
93 | setCentralWidget( border ); | 96 | setCentralWidget( border ); |
94 | 97 | ||
95 | QVBoxLayout *borderLayout = new QVBoxLayout( border ); | 98 | QVBoxLayout *borderLayout = new QVBoxLayout( border ); |
96 | 99 | ||
97 | QWidget *mainWin = new QWidget( border ); | 100 | QWidget *mainWin = new QWidget( border ); |
98 | borderLayout->addWidget( mainWin, 2, AlignHCenter ); | 101 | borderLayout->addWidget( mainWin, 2, AlignHCenter ); |
99 | 102 | ||
100 | view = new KAsteroidsView( mainWin ); | 103 | view = new KAsteroidsView( mainWin ); |
101 | connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) ); | 104 | connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) ); |
102 | connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) ); | 105 | connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) ); |
103 | connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) ); | 106 | connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) ); |
104 | connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) ); | 107 | connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) ); |
105 | 108 | ||
106 | QVBoxLayout *vb = new QVBoxLayout( mainWin ); | 109 | QVBoxLayout *vb = new QVBoxLayout( mainWin ); |
107 | QHBoxLayout *hb = new QHBoxLayout; | 110 | QHBoxLayout *hb = new QHBoxLayout; |
108 | QHBoxLayout *hbd = new QHBoxLayout; | 111 | QHBoxLayout *hbd = new QHBoxLayout; |
@@ -248,25 +251,25 @@ KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name ) | |||
248 | shipsRemain = 3; | 251 | shipsRemain = 3; |
249 | showHiscores = FALSE; | 252 | showHiscores = FALSE; |
250 | 253 | ||
251 | actions.insert( Qt::Key_Up, Thrust ); | 254 | actions.insert( Qt::Key_Up, Thrust ); |
252 | actions.insert( Qt::Key_Left, RotateLeft ); | 255 | actions.insert( Qt::Key_Left, RotateLeft ); |
253 | actions.insert( Qt::Key_Right, RotateRight ); | 256 | actions.insert( Qt::Key_Right, RotateRight ); |
254 | actions.insert( Qt::Key_Enter, Shoot ); | 257 | actions.insert( Qt::Key_Enter, Shoot ); |
255 | actions.insert( Qt::Key_Z, Teleport ); | 258 | actions.insert( Qt::Key_Z, Teleport ); |
256 | actions.insert( Qt::Key_Down, Brake ); | 259 | actions.insert( Qt::Key_Down, Brake ); |
257 | actions.insert( Qt::Key_P, Pause ); | 260 | actions.insert( Qt::Key_P, Pause ); |
258 | 261 | ||
259 | 262 | ||
260 | struct utsname name; /* check for embedix kernel running on the zaurus, if | 263 | struct utsname name; /* check for embedix kernel running on the zaurus, if |
261 | lineo change string, this break | 264 | lineo change string, this break |
262 | */ | 265 | */ |
263 | if (uname(&name) != -1) { | 266 | if (uname(&name) != -1) { |
264 | QString release=name.release; | 267 | QString release=name.release; |
265 | if(release.find("embedix",0,TRUE) !=-1) { | 268 | if(release.find("embedix",0,TRUE) !=-1) { |
266 | actions.insert( Key_F12, Launch ); | 269 | actions.insert( Key_F12, Launch ); |
267 | actions.insert( Key_F11, Shield ); | 270 | actions.insert( Key_F11, Shield ); |
268 | actions.insert( Key_F9, NewGame ); | 271 | actions.insert( Key_F9, NewGame ); |
269 | } else { | 272 | } else { |
270 | // ipaq | 273 | // ipaq |
271 | actions.insert( Key_F12, Shoot ); | 274 | actions.insert( Key_F12, Shoot ); |
272 | actions.insert( Key_F11, Shield ); | 275 | actions.insert( Key_F11, Shield ); |
@@ -386,25 +389,25 @@ void KAstTopLevel::keyReleaseEvent( QKeyEvent *event ) | |||
386 | if ( waitShip ) | 389 | if ( waitShip ) |
387 | { | 390 | { |
388 | view->newShip(); | 391 | view->newShip(); |
389 | waitShip = FALSE; | 392 | waitShip = FALSE; |
390 | view->hideText(); | 393 | view->hideText(); |
391 | } | 394 | } |
392 | else | 395 | else |
393 | { | 396 | { |
394 | event->ignore(); | 397 | event->ignore(); |
395 | return; | 398 | return; |
396 | } | 399 | } |
397 | break; | 400 | break; |
398 | 401 | ||
399 | case NewGame: | 402 | case NewGame: |
400 | slotNewGame(); | 403 | slotNewGame(); |
401 | break; | 404 | break; |
402 | /* | 405 | /* |
403 | case Pause: | 406 | case Pause: |
404 | { | 407 | { |
405 | view->pause( TRUE ); | 408 | view->pause( TRUE ); |
406 | QMessageBox::information( this, | 409 | QMessageBox::information( this, |
407 | tr("KAsteroids is paused"), | 410 | tr("KAsteroids is paused"), |
408 | tr("Paused") ); | 411 | tr("Paused") ); |
409 | view->pause( FALSE ); | 412 | view->pause( FALSE ); |
410 | } | 413 | } |
diff --git a/noncore/games/qasteroids/toplevel.h b/noncore/games/qasteroids/toplevel.h index 4e1ac9c..0270763 100644 --- a/noncore/games/qasteroids/toplevel.h +++ b/noncore/games/qasteroids/toplevel.h | |||
@@ -30,26 +30,28 @@ | |||
30 | #include <qmap.h> | 30 | #include <qmap.h> |
31 | 31 | ||
32 | #include "view.h" | 32 | #include "view.h" |
33 | 33 | ||
34 | 34 | ||
35 | class KALedMeter; | 35 | class KALedMeter; |
36 | class QLCDNumber; | 36 | class QLCDNumber; |
37 | 37 | ||
38 | class KAstTopLevel : public QMainWindow | 38 | class KAstTopLevel : public QMainWindow |
39 | { | 39 | { |
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | public: | 41 | public: |
42 | KAstTopLevel( QWidget *parent=0, const char *name=0 ); | 42 | KAstTopLevel( QWidget *parent=0, const char *name=0, WFlags fl = 0 ); |
43 | virtual ~KAstTopLevel(); | 43 | virtual ~KAstTopLevel(); |
44 | static QString appName() { return QString::fromLatin1("qasteroids"); } | ||
45 | |||
44 | 46 | ||
45 | private: | 47 | private: |
46 | void playSound( const char *snd ); | 48 | void playSound( const char *snd ); |
47 | void readSoundMapping(); | 49 | void readSoundMapping(); |
48 | void doStats(); | 50 | void doStats(); |
49 | 51 | ||
50 | protected: | 52 | protected: |
51 | virtual void showEvent( QShowEvent * ); | 53 | virtual void showEvent( QShowEvent * ); |
52 | virtual void hideEvent( QHideEvent * ); | 54 | virtual void hideEvent( QHideEvent * ); |
53 | virtual void keyPressEvent( QKeyEvent *event ); | 55 | virtual void keyPressEvent( QKeyEvent *event ); |
54 | virtual void keyReleaseEvent( QKeyEvent *event ); | 56 | virtual void keyReleaseEvent( QKeyEvent *event ); |
55 | virtual void focusInEvent( QFocusEvent *event ); | 57 | virtual void focusInEvent( QFocusEvent *event ); |