-rw-r--r-- | noncore/games/sfcave/opie-sfcave.control | 2 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.cpp | 48 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.h | 8 | ||||
-rw-r--r-- | noncore/games/sfcave/sfcave.pro | 5 |
4 files changed, 21 insertions, 42 deletions
diff --git a/noncore/games/sfcave/opie-sfcave.control b/noncore/games/sfcave/opie-sfcave.control index 0ff3e2c..1d98a19 100644 --- a/noncore/games/sfcave/opie-sfcave.control +++ b/noncore/games/sfcave/opie-sfcave.control @@ -1,9 +1,9 @@ Package: opie-sfcave -Files: bin/sfcave apps/Games/sfcave.desktop pics/sfcave +Files: plugins/applications/libsfcave.so* bin/sfcave apps/Games/sfcave.desktop pics/sfcave Priority: optional Section: opie/games Maintainer: Andy Qua <andy.qua@blueyonder.co.uk> Architecture: arm Depends: task-opie-minimal Description: SFCave for the Zaurus. Fly the dot though the cave avoiding the walls. Version: $QPE_VERSION$EXTRAVERSION diff --git a/noncore/games/sfcave/sfcave.cpp b/noncore/games/sfcave/sfcave.cpp index 9b30fe6..5dca427 100644 --- a/noncore/games/sfcave/sfcave.cpp +++ b/noncore/games/sfcave/sfcave.cpp @@ -1,23 +1,21 @@ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> -#ifdef QWS -#include <qpe/qpeapplication.h> +#include <opie2/oapplicationfactory.h> #include <qpe/config.h> -#else + #include <qapplication.h> -#endif #include <qdir.h> #include "helpwindow.h" #include "sfcave.h" #define CAPTION "SFCave 1.13 by AndyQ" #define UP_THRUST 0.6 #define NO_THRUST 0.8 #define MAX_DOWN_THRUST 4.0 #define MAX_UP_THRUST -3.5 @@ -123,60 +121,36 @@ int SFCave::flyHardScores[7][3] = { { 0, 20, 5 }, { 40, 100, 1 }, { 100, 150, -2 }, { 150, 300, -5 }, { -1, -1, -1 } }; int SFCave::initialGateGaps[] = { 75, 50, 25 }; #define FLYSCORES( x, y ) (*(flyScores + ((x)*3) + y)) bool movel; -int main( int argc, char *argv[] ) -{ - movel = true; -#ifdef QWS - QPEApplication a( argc, argv ); -#else - QApplication a( argc, argv ); -#endif +OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<SFCave> ) - int speed = 3; - for ( int i = 0 ; i < argc ; ++i ) - { - if ( strcmp( argv[i], "-s" ) == 0 ) - { - if ( i+1 < argc ) - speed = atoi( argv[i+1] ); - } - } - - SFCave app( speed ); - a.setMainWidget( &app ); - app.show(); - app.start(); - a.exec(); -} - -SFCave :: SFCave( int spd, QWidget *w, char *name ) - : QMainWindow( w, name ) +SFCave :: SFCave( QWidget *w, const char *name, WFlags fl ) + : QMainWindow( w, name, fl ) { - replayIt = 0; -#ifdef QWS showMaximized(); -#else - resize( 240, 284 ); -#endif + movel = true; + int spd = 3; + + + replayIt = 0; replayFile = QDir::home().path(); replayFile += "/sfcave.replay"; printf( "%s\n", (const char *)replayFile ); sWidth = width(); sHeight = height(); segSize = sWidth/(MAPSIZE-1)+1; currentMenuNr = 0; currentGameType = 0; currentGameDifficulty = 0; @@ -204,24 +178,26 @@ SFCave :: SFCave( int spd, QWidget *w, char *name ) offscreen = new QPixmap( sWidth, sHeight ); offscreen->fill( Qt::black ); // setUp(); crashLineLength = -1; state = STATE_MENU; prevState = STATE_MENU; gameTimer = new QTimer( this, "game timer" ); connect( gameTimer, SIGNAL( timeout() ), this, SLOT( run() ) ); + + QTimer::singleShot(0, this, SLOT(start())); } SFCave :: ~SFCave() { } void SFCave :: start() { gameTimer->start( 10 ); } diff --git a/noncore/games/sfcave/sfcave.h b/noncore/games/sfcave/sfcave.h index b1fe819..7bdf881 100644 --- a/noncore/games/sfcave/sfcave.h +++ b/noncore/games/sfcave/sfcave.h @@ -86,27 +86,33 @@ public: int offset; int maxHeight; int nrFrames; int dir; bool showScoreZones; bool press; double thrust; bool running; - SFCave( int speed = 3, QWidget *p = 0, char *name = 0 ); + SFCave( QWidget *p = 0, const char *name = 0, WFlags fl = 0 ); ~SFCave(); + + static QString appName() { return QString::fromLatin1( QUICKAPP_NAME ); } + +public slots: void start(); +public: + void setSeed( int seed ); int nextInt( int range ); void setUp(); void handleGameSFCave(); void handleGameGates(); void handleGameFly(); bool checkFlyGameCollision(); void moveFlyGameLandscape(); void setFlyPoint( int point ); bool checkCollision(); void moveLandscape(); void addBlock(); diff --git a/noncore/games/sfcave/sfcave.pro b/noncore/games/sfcave/sfcave.pro index a0df828..3a26a79 100644 --- a/noncore/games/sfcave/sfcave.pro +++ b/noncore/games/sfcave/sfcave.pro @@ -1,13 +1,10 @@ -TEMPLATE = app -CONFIG += qt warn_on -DESTDIR = $(OPIEDIR)/bin +CONFIG += qt quick-app SOURCES = sfcave.cpp helpwindow.cpp random.cpp HEADERS = sfcave.h helpwindow.h random.h TARGET = sfcave INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lqpe - include ( $(OPIEDIR)/include.pro ) |