summaryrefslogtreecommitdiff
path: root/noncore/games/parashoot
authorzecke <zecke>2004-02-06 12:14:56 (UTC)
committer zecke <zecke>2004-02-06 12:14:56 (UTC)
commit0c74629e8f5c12a9b5a282b817f884fa10dee491 (patch) (side-by-side diff)
tree3294663b92023f8d24d68a01022e011a3c94002d /noncore/games/parashoot
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/parashoot') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/parashoot/interface.cpp33
-rw-r--r--noncore/games/parashoot/interface.h1
-rw-r--r--noncore/games/parashoot/main.cpp13
-rw-r--r--noncore/games/parashoot/opie-parashoot.control2
-rw-r--r--noncore/games/parashoot/parashoot.pro6
5 files changed, 25 insertions, 30 deletions
diff --git a/noncore/games/parashoot/interface.cpp b/noncore/games/parashoot/interface.cpp
index db98720..a40426d 100644
--- a/noncore/games/parashoot/interface.cpp
+++ b/noncore/games/parashoot/interface.cpp
@@ -22,6 +22,7 @@
#include "man.h"
#include <qpe/resource.h>
+#include <qpe/qpeapplication.h>
#include <qlabel.h>
#include <qmessagebox.h>
@@ -29,13 +30,15 @@
#include <qstyle.h>
#include <qpe/qpetoolbar.h>
#include <qtoolbutton.h>
-
+
ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) :
QMainWindow(parent,name,f),
canvas(232, 258),
fanfare("level_up"),
score(0)
{
+ QPEApplication::grabKeyboard();
+ QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff );
canvas.setAdvancePeriod(80);
QPixmap bg = Resource::loadPixmap("parashoot/sky");
canvas.setBackgroundPixmap(bg);
@@ -59,14 +62,14 @@ ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) :
levelscore->setAlignment( AlignRight | AlignVCenter | ExpandTabs );
toolbar->setStretchableWidget( levelscore );
showScore(0,0);
-
+
setCentralWidget(pb);
autoDropTimer = new QTimer(this);
connect (autoDropTimer, SIGNAL(timeout()), this, SLOT(play()) );
-
+
pauseTimer = new QTimer(this);
- connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
+ connect(pauseTimer, SIGNAL(timeout()), this, SLOT(wait()) );
setFocusPolicy(StrongFocus);
@@ -91,7 +94,7 @@ void ParaShoot::showScore( int score, int level )
void ParaShoot::newGame()
{
clear();
- if (pauseTimer->isActive())
+ if (pauseTimer->isActive())
pauseTimer->stop();
clear();
Man::setManCount(0);
@@ -119,7 +122,7 @@ void ParaShoot::clear()
// QCanvasItem* item;
QCanvasItemList l = canvas.allItems();
for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
- delete *it;
+ delete *it;
}
}
@@ -127,7 +130,7 @@ void ParaShoot::gameOver()
{
QCanvasItem* item;
QCanvasItemList l = canvas.allItems();
- for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
+ for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) {
item = *it;
if ((item->rtti()==1500) || (item->rtti()==1600) || item->rtti()==1900)
item->setAnimated(false);
@@ -138,13 +141,13 @@ void ParaShoot::gameOver()
int shots = Bullet::getShotCount();
int shotsFired = cannon->shotsFired();
- if ( shotsFired == 0 )
+ if ( shotsFired == 0 )
shotsFired = 1;
QCanvasText* gameover = new QCanvasText(
tr( " GAME OVER!\n"
" Your Score: %1\n"
" Parachuters Killed: %2\n"
- " Accuracy: %3% " ).arg(score).arg(shots).arg(shots * 100 / shotsFired ),
+ " Accuracy: %3% " ).arg(score).arg(shots).arg(shots * 100 / shotsFired ),
&canvas);
gameover->setColor(red);
gameover->setFont( QFont("times", 18, QFont::Bold) );
@@ -163,7 +166,7 @@ void ParaShoot::wait()
}
void ParaShoot::play()
-{
+{
if (Man::getManCount() < nomen ) {
new Man(&canvas);
}
@@ -177,13 +180,13 @@ void ParaShoot::increaseScore(int x)
{
score += x;
if ( score / 150 != (score-x) / 150 )
- levelUp();
+ levelUp();
showScore(level,score);
}
void ParaShoot::levelUp()
{
- level++;
+ level++;
int stage = level % 3;
switch(stage) {
case 0:
@@ -193,11 +196,11 @@ void ParaShoot::levelUp()
break;
case 1:
new Helicopter(&canvas);
- break;
+ break;
case 2:
moveFaster();
fanfare.play();
- break;
+ break;
default: return;
}
}
@@ -216,7 +219,7 @@ void ParaShoot::keyPressEvent(QKeyEvent* event)
if (gamestopped) {
if (waitover)
newGame();
- else
+ else
return;
} else {
switch(event->key()) {
diff --git a/noncore/games/parashoot/interface.h b/noncore/games/parashoot/interface.h
index 3f36d0b..5abbe0b 100644
--- a/noncore/games/parashoot/interface.h
+++ b/noncore/games/parashoot/interface.h
@@ -38,6 +38,7 @@ class ParaShoot : public QMainWindow {
Q_OBJECT
public:
+ static QString appName() { return QString::fromLatin1("parashoot"); }
ParaShoot(QWidget* parent=0, const char* name=0, WFlags f=0);
void clear();
diff --git a/noncore/games/parashoot/main.cpp b/noncore/games/parashoot/main.cpp
index 60eea18..ee36d26 100644
--- a/noncore/games/parashoot/main.cpp
+++ b/noncore/games/parashoot/main.cpp
@@ -21,16 +21,7 @@
#include "interface.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main(int argc, char **argv)
-{
- QPEApplication app(argc,argv);
+OPIE_EXPORT_APP( OApplicationFactory<ParaShoot> )
- QPEApplication::grabKeyboard();
-
- ParaShoot m;
- QPEApplication::setInputMethodHint( &m, QPEApplication::AlwaysOff );
- app.showMainWidget(&m);
-
- return app.exec();
-}
diff --git a/noncore/games/parashoot/opie-parashoot.control b/noncore/games/parashoot/opie-parashoot.control
index 758d24d..139dd3c 100644
--- a/noncore/games/parashoot/opie-parashoot.control
+++ b/noncore/games/parashoot/opie-parashoot.control
@@ -1,5 +1,5 @@
Package: opie-parashoot
-Files: bin/parashoot apps/Games/parashoot.desktop pics/parashoot
+Files: plugins/application/libparashoot.so* bin/parashoot apps/Games/parashoot.desktop pics/parashoot
Priority: optional
Section: opie/games
Maintainer: Martin Imobersteg <imm@gmx.ch>
diff --git a/noncore/games/parashoot/parashoot.pro b/noncore/games/parashoot/parashoot.pro
index c2746f9..f5d103a 100644
--- a/noncore/games/parashoot/parashoot.pro
+++ b/noncore/games/parashoot/parashoot.pro
@@ -1,6 +1,4 @@
-TEMPLATE = app
-CONFIG += qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG += qt warn_on release quick-app
HEADERS = interface.h man.h cannon.h base.h bullet.h helicopter.h
SOURCES = main.cpp interface.cpp man.cpp cannon.cpp base.cpp bullet.cpp helicopter.cpp
TARGET = parashoot
@@ -8,4 +6,6 @@ INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
+
+
include ( $(OPIEDIR)/include.pro )