summaryrefslogtreecommitdiff
path: root/noncore/games/qasteroids
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/qasteroids
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/qasteroids') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/qasteroids/main.cpp13
-rw-r--r--noncore/games/qasteroids/opie-qasteroids.control2
-rw-r--r--noncore/games/qasteroids/qasteroids.pro6
-rw-r--r--noncore/games/qasteroids/toplevel.cpp19
-rw-r--r--noncore/games/qasteroids/toplevel.h4
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
@@ -1,36 +1,27 @@
/**********************************************************************
** Copyright (C) 2000 Trolltech AS. All rights reserved.
**
** This file is part of Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "toplevel.h"
#include <qpe/qpeapplication.h>
+#include <opie/oapplicationfactory.h>
-int main( int argc, char *argv[] )
-{
- QPEApplication app( argc, argv );
-
- QPEApplication::grabKeyboard();
-
- KAstTopLevel *mainWidget = new KAstTopLevel();
- app.showMainWidget( mainWidget );
-
- app.exec();
-}
+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 @@
Package: opie-qasteroids
-Files: bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/*
+Files: plugins/application/libqasteroids.so* bin/qasteroids apps/Games/qasteroids.desktop pics/qasteroids/*
Priority: optional
Section: opie/games
Maintainer: Martin Jones <mjones@trolltech.com>
Architecture: arm
Depends: task-opie-minimal
Description: Game: shoot the asteroids
A game for the Opie environment.
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 @@
-TEMPLATE = app
-CONFIG += qt warn_on release
-DESTDIR = $(OPIEDIR)/bin
+CONFIG += qt warn_on release quick-app
HEADERS = ledmeter.h sprites.h toplevel.h view.h
SOURCES = ledmeter.cpp toplevel.cpp view.cpp main.cpp
TARGET = qasteroids
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe
+
+
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
@@ -48,73 +48,76 @@ struct SLevel
double rockSpeed;
};
#define MAX_LEVELS 16
SLevel levels[MAX_LEVELS] =
{
{ 1, 0.4 },
{ 1, 0.6 },
{ 2, 0.5 },
{ 2, 0.7 },
{ 2, 0.8 },
{ 3, 0.6 },
{ 3, 0.7 },
{ 3, 0.8 },
{ 4, 0.6 },
{ 4, 0.7 },
{ 4, 0.8 },
{ 5, 0.7 },
{ 5, 0.8 },
{ 5, 0.9 },
{ 5, 1.0 }
};
-const char *soundEvents[] =
+const char *soundEvents[] =
{
"ShipDestroyed",
"RockDestroyed",
0
};
-const char *soundDefaults[] =
+const char *soundDefaults[] =
{
"Explosion.wav",
"ploop.wav",
0
};
-
-KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name )
- : QMainWindow( parent, _name )
+
+KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name, WFlags fl )
+ : QMainWindow( parent, _name, fl )
{
setCaption( tr("Asteroids") );
+
+ QPEApplication::grabKeyboard();
+
QWidget *border = new QWidget( this );
border->setBackgroundColor( black );
setCentralWidget( border );
QVBoxLayout *borderLayout = new QVBoxLayout( border );
-
+
QWidget *mainWin = new QWidget( border );
borderLayout->addWidget( mainWin, 2, AlignHCenter );
view = new KAsteroidsView( mainWin );
connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
QVBoxLayout *vb = new QVBoxLayout( mainWin );
QHBoxLayout *hb = new QHBoxLayout;
QHBoxLayout *hbd = new QHBoxLayout;
vb->addLayout( hb );
QFont labelFont( "helvetica", 12 );
QColorGroup grp( darkGreen, black, QColor( 128, 128, 128 ),
QColor( 64, 64, 64 ), black, darkGreen, black );
QPalette pal( grp, grp, grp );
mainWin->setPalette( pal );
QLabel *label;
label = new QLabel( tr("Score"), mainWin );
label->setFont( labelFont );
@@ -236,49 +239,49 @@ KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name )
powerMeter = new KALedMeter( mainWin );
powerMeter->setFrameStyle( QFrame::Box | QFrame::Plain );
powerMeter->setRange( MAX_POWER_LEVEL );
powerMeter->addColorRange( 10, darkRed );
powerMeter->addColorRange( 20, QColor(160, 96, 0) );
powerMeter->addColorRange( 70, darkGreen );
powerMeter->setCount( 15 );
powerMeter->setPalette( pal );
powerMeter->setFixedSize( 60, 12 );
hbd->addWidget( powerMeter );
shipsRemain = 3;
showHiscores = FALSE;
actions.insert( Qt::Key_Up, Thrust );
actions.insert( Qt::Key_Left, RotateLeft );
actions.insert( Qt::Key_Right, RotateRight );
actions.insert( Qt::Key_Enter, Shoot );
actions.insert( Qt::Key_Z, Teleport );
actions.insert( Qt::Key_Down, Brake );
actions.insert( Qt::Key_P, Pause );
- struct utsname name; /* check for embedix kernel running on the zaurus, if
+ struct utsname name; /* check for embedix kernel running on the zaurus, if
lineo change string, this break
*/
if (uname(&name) != -1) {
QString release=name.release;
if(release.find("embedix",0,TRUE) !=-1) {
actions.insert( Key_F12, Launch );
actions.insert( Key_F11, Shield );
actions.insert( Key_F9, NewGame );
} else {
// ipaq
actions.insert( Key_F12, Shoot );
actions.insert( Key_F11, Shield );
actions.insert( Key_F10, Launch );
actions.insert( Key_F9, NewGame );
}
}
// actions.insert( Qt::Key_S, Shield );
// actions.insert( Qt::Key_X, Brake );
// actions.insert( Qt::Key_L, Launch );
actions.insert( Qt::Key_Space, Shoot );
view->showText( tr( "Press Calendar to start playing" ), yellow );
@@ -374,49 +377,49 @@ void KAstTopLevel::keyReleaseEvent( QKeyEvent *event )
view->brake( FALSE );
break;
case Shield:
view->setShield( FALSE );
break;
case Teleport:
view->teleport( FALSE );
break;
case Launch:
if ( waitShip )
{
view->newShip();
waitShip = FALSE;
view->hideText();
}
else
{
event->ignore();
return;
}
break;
-
+
case NewGame:
slotNewGame();
break;
/*
case Pause:
{
view->pause( TRUE );
QMessageBox::information( this,
tr("KAsteroids is paused"),
tr("Paused") );
view->pause( FALSE );
}
break;
*/
default:
event->ignore();
return;
}
event->accept();
}
void KAstTopLevel::showEvent( QShowEvent *e )
{
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
@@ -18,50 +18,52 @@
**
**********************************************************************//*
* KAsteroids - Copyright (c) Martin R. Jones 1997
*
* Part of the KDE project
*/
#ifndef __KAST_TOPLEVEL_H__
#define __KAST_TOPLEVEL_H__
#include <qmainwindow.h>
#include <qdict.h>
#include <qmap.h>
#include "view.h"
class KALedMeter;
class QLCDNumber;
class KAstTopLevel : public QMainWindow
{
Q_OBJECT
public:
- KAstTopLevel( QWidget *parent=0, const char *name=0 );
+ KAstTopLevel( QWidget *parent=0, const char *name=0, WFlags fl = 0 );
virtual ~KAstTopLevel();
+ static QString appName() { return QString::fromLatin1("qasteroids"); }
+
private:
void playSound( const char *snd );
void readSoundMapping();
void doStats();
protected:
virtual void showEvent( QShowEvent * );
virtual void hideEvent( QHideEvent * );
virtual void keyPressEvent( QKeyEvent *event );
virtual void keyReleaseEvent( QKeyEvent *event );
virtual void focusInEvent( QFocusEvent *event );
virtual void focusOutEvent( QFocusEvent *event );
private slots:
void slotNewGame();
void slotShipKilled();
void slotRockHit( int size );
void slotRocksRemoved();
void slotUpdateVitals();
private: