Diffstat (limited to 'noncore/games/parashoot/interface.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/parashoot/interface.cpp | 33 |
1 files changed, 18 insertions, 15 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 @@ -23,4 +23,5 @@ #include <qpe/resource.h> +#include <qpe/qpeapplication.h> #include <qlabel.h> @@ -30,5 +31,5 @@ #include <qpe/qpetoolbar.h> #include <qtoolbutton.h> - + ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : QMainWindow(parent,name,f), @@ -37,4 +38,6 @@ ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : score(0) { + QPEApplication::grabKeyboard(); + QPEApplication::setInputMethodHint(this, QPEApplication::AlwaysOff ); canvas.setAdvancePeriod(80); QPixmap bg = Resource::loadPixmap("parashoot/sky"); @@ -60,12 +63,12 @@ ParaShoot::ParaShoot(QWidget* parent, const char* name, WFlags f) : 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); @@ -92,5 +95,5 @@ void ParaShoot::newGame() { clear(); - if (pauseTimer->isActive()) + if (pauseTimer->isActive()) pauseTimer->stop(); clear(); @@ -120,5 +123,5 @@ void ParaShoot::clear() QCanvasItemList l = canvas.allItems(); for (QCanvasItemList::Iterator it=l.begin(); it!=l.end(); ++it) { - delete *it; + delete *it; } } @@ -128,5 +131,5 @@ 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) @@ -139,5 +142,5 @@ void ParaShoot::gameOver() int shotsFired = cannon->shotsFired(); - if ( shotsFired == 0 ) + if ( shotsFired == 0 ) shotsFired = 1; QCanvasText* gameover = new QCanvasText( @@ -145,5 +148,5 @@ void ParaShoot::gameOver() " 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); @@ -164,5 +167,5 @@ void ParaShoot::wait() void ParaShoot::play() -{ +{ if (Man::getManCount() < nomen ) { new Man(&canvas); @@ -178,5 +181,5 @@ void ParaShoot::increaseScore(int x) score += x; if ( score / 150 != (score-x) / 150 ) - levelUp(); + levelUp(); showScore(level,score); } @@ -184,5 +187,5 @@ void ParaShoot::increaseScore(int x) void ParaShoot::levelUp() { - level++; + level++; int stage = level % 3; switch(stage) { @@ -194,9 +197,9 @@ void ParaShoot::levelUp() case 1: new Helicopter(&canvas); - break; + break; case 2: moveFaster(); fanfare.play(); - break; + break; default: return; } @@ -217,5 +220,5 @@ void ParaShoot::keyPressEvent(QKeyEvent* event) if (waitover) newGame(); - else + else return; } else { |