author | drw <drw> | 2005-05-18 14:28:05 (UTC) |
---|---|---|
committer | drw <drw> | 2005-05-18 14:28:05 (UTC) |
commit | cb243f00d12c5fc40de02e7f9f20009b52303a66 (patch) (side-by-side diff) | |
tree | f85e840af4db55a67a2a057d6a7f4ef59bfb4385 | |
parent | 600f14a61969ec2edd6d89efecaac997b1c6464f (diff) | |
download | opie-cb243f00d12c5fc40de02e7f9f20009b52303a66.zip opie-cb243f00d12c5fc40de02e7f9f20009b52303a66.tar.gz opie-cb243f00d12c5fc40de02e7f9f20009b52303a66.tar.bz2 |
Resource -> OResource
-rw-r--r-- | noncore/games/qasteroids/toplevel.cpp | 9 | ||||
-rw-r--r-- | noncore/games/qasteroids/view.cpp | 14 |
2 files changed, 10 insertions, 13 deletions
diff --git a/noncore/games/qasteroids/toplevel.cpp b/noncore/games/qasteroids/toplevel.cpp index 9053d3d..d1e1fac 100644 --- a/noncore/games/qasteroids/toplevel.cpp +++ b/noncore/games/qasteroids/toplevel.cpp @@ -5,50 +5,51 @@ ** ** 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. ** **********************************************************************//* * KAsteroids - Copyright (c) Martin R. Jones 1997 * * Part of the KDE project */ // --- toplevel.cpp --- #include "toplevel.h" #include "ledmeter.h" +#include <opie2/oresource.h> + #include <qpe/qpeapplication.h> -#include <qpe/resource.h> #include <qlabel.h> #include <qlayout.h> #include <qlcdnumber.h> #include <sys/utsname.h> #define SB_SCORE 1 #define SB_LEVEL 2 #define SB_SHIPS 3 struct SLevel { int nrocks; double rockSpeed; }; #define MAX_LEVELS 16 SLevel levels[MAX_LEVELS] = { { 1, 0.4 }, { 1, 0.6 }, @@ -164,79 +165,79 @@ KAstTopLevel::KAstTopLevel( QWidget *parent, const char *_name, WFlags fl ) // -- bottom layout: vb->addLayout( hbd ); QFont smallFont( "helvetica", 12 ); hbd->addSpacing( 5 ); /* label = new QLabel( tr( "T" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() ); label->setPalette( pal ); hbd->addWidget( label ); teleportsLCD = new QLCDNumber( 1, mainWin ); teleportsLCD->setFrameStyle( QFrame::NoFrame ); teleportsLCD->setSegmentStyle( QLCDNumber::Flat ); teleportsLCD->setPalette( pal ); teleportsLCD->setFixedHeight( 18 ); hbd->addWidget( teleportsLCD ); hbd->addSpacing( 10 ); */ label = new QLabel( mainWin ); - label->setPixmap( Resource::loadPixmap("qasteroids/powerups/brake.png") ); + label->setPixmap( Opie::Core::OResource::loadPixmap("qasteroids/powerups/brake.png") ); label->setFixedWidth( 16 ); label->setPalette( pal ); hbd->addWidget( label ); brakesLCD = new QLCDNumber( 1, mainWin ); brakesLCD->setFrameStyle( QFrame::NoFrame ); brakesLCD->setSegmentStyle( QLCDNumber::Flat ); brakesLCD->setPalette( pal ); brakesLCD->setFixedHeight( 16 ); hbd->addWidget( brakesLCD ); hbd->addSpacing( 5 ); label = new QLabel( mainWin ); - label->setPixmap( Resource::loadPixmap("qasteroids/powerups/shield.png") ); + label->setPixmap( Opie::Core::OResource::loadPixmap("qasteroids/powerups/shield.png") ); label->setFixedWidth( 16 ); label->setPalette( pal ); hbd->addWidget( label ); shieldLCD = new QLCDNumber( 1, mainWin ); shieldLCD->setFrameStyle( QFrame::NoFrame ); shieldLCD->setSegmentStyle( QLCDNumber::Flat ); shieldLCD->setPalette( pal ); shieldLCD->setFixedHeight( 16 ); hbd->addWidget( shieldLCD ); hbd->addSpacing( 5 ); label = new QLabel( mainWin ); - label->setPixmap( Resource::loadPixmap("qasteroids/powerups/shoot.png") ); + label->setPixmap( Opie::Core::OResource::loadPixmap("qasteroids/powerups/shoot.png") ); label->setFixedWidth( 16 ); label->setPalette( pal ); hbd->addWidget( label ); shootLCD = new QLCDNumber( 1, mainWin ); shootLCD->setFrameStyle( QFrame::NoFrame ); shootLCD->setSegmentStyle( QLCDNumber::Flat ); shootLCD->setPalette( pal ); shootLCD->setFixedHeight( 16 ); hbd->addWidget( shootLCD ); hbd->addStretch( 1 ); label = new QLabel( tr( "Fuel" ), mainWin ); label->setFont( smallFont ); label->setFixedWidth( label->sizeHint().width() + 5 ); label->setPalette( pal ); hbd->addWidget( label ); 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) ); diff --git a/noncore/games/qasteroids/view.cpp b/noncore/games/qasteroids/view.cpp index 3a4d410..6cab700 100644 --- a/noncore/games/qasteroids/view.cpp +++ b/noncore/games/qasteroids/view.cpp @@ -3,55 +3,55 @@ ** ** 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. ** **********************************************************************//* * KAsteroids - Copyright (c) Martin R. Jones 1997 * * Part of the KDE project */ #include "view.h" -#include <qpe/resource.h> - +#include <opie2/oresource.h> +#include <qpe/qpeapplication.h> #include <stdlib.h> #include <math.h> -#define IMG_BACKGROUND "qasteroids/bg.png" +#define IMG_BACKGROUND "qasteroids/bg" #define REFRESH_DELAY 33 #define SHIP_SPEED 0.3 #define MISSILE_SPEED 10.0 #define SHIP_STEPS 64 #define ROTATE_RATE 2 #define SHIELD_ON_COST 1 #define SHIELD_HIT_COST 30 #define BRAKE_ON_COST 4 #define MAX_ROCK_SPEED 2.5 #define MAX_POWERUP_SPEED 1.5 #define MAX_SHIP_SPEED 8 #define MAX_BRAKES 5 #define MAX_SHIELDS 5 #define MAX_FIREPOWER 5 #define TEXT_SPEED 4 #define PI_X_2 6.283185307 #ifndef M_PI #define M_PI 3.141592654 #endif @@ -74,50 +74,49 @@ static const kas_animations_t kas_animations [] = { ID_ENERGY_POWERUP, "powerups/energy.png", 0 }, // { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 }, { ID_BRAKE_POWERUP, "powerups/brake.png", 0 }, { ID_SHIELD_POWERUP, "powerups/shield.png", 0 }, { ID_SHOOT_POWERUP, "powerups/shoot.png", 0 }, { ID_SHIELD, "shield/shield\%1.png", 6 }, { 0, 0, 0 } }; KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) : QWidget( parent, name ), field(200, 200), view(&field,this) { view.setVScrollBarMode( QScrollView::AlwaysOff ); view.setHScrollBarMode( QScrollView::AlwaysOff ); rocks.setAutoDelete( TRUE ); missiles.setAutoDelete( TRUE ); bits.setAutoDelete( TRUE ); powerups.setAutoDelete( TRUE ); exhaust.setAutoDelete( TRUE ); - QPixmap pm( Resource::loadPixmap(IMG_BACKGROUND) ); - field.setBackgroundPixmap( pm ); + field.setBackgroundPixmap( Opie::Core::OResource::loadPixmap(IMG_BACKGROUND) ); textSprite = new QCanvasText( &field ); QFont font( "helvetica", 14 ); textSprite->setFont( font ); shield = 0; shieldOn = FALSE; refreshRate = REFRESH_DELAY; readSprites(); shieldTimer = new QTimer( this ); connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) ); mTimerId = -1; shipPower = MAX_POWER_LEVEL; vitalsChanged = TRUE; can_destroy_powerups = FALSE; mPaused = TRUE; } // - - - @@ -227,52 +226,49 @@ void KAsteroidsView::setShield( bool s ) shieldOn = s && mShieldCount; } } void KAsteroidsView::brake( bool b ) { if ( mBrakeCount ) { if ( brakeShip && !b ) { rotateL = FALSE; rotateR = FALSE; thrustShip = FALSE; rotateRate = ROTATE_RATE; } brakeShip = b; } } // - - - void KAsteroidsView::readSprites() { - QString sprites_prefix = Resource::findPixmap( IMG_BACKGROUND ); - int sep = sprites_prefix.findRev( "/" ); - - sprites_prefix.truncate( sep ); + QString sprites_prefix = QPEApplication::qpeDir() + "pics/qasteroids"; int i = 0; while ( kas_animations[i].id ) { animation.insert( kas_animations[i].id, new QCanvasPixmapArray( sprites_prefix + "/" + kas_animations[i].path, kas_animations[i].frames ) ); i++; } ship = new QCanvasSprite( animation[ID_SHIP], &field ); ship->hide(); shield = new KShield( animation[ID_SHIELD], &field ); shield->hide(); } // - - - void KAsteroidsView::addRocks( int num ) { for ( int i = 0; i < num; i++ ) { KRock *rock = new KRock( animation[ID_ROCK_MEDIUM], &field, |