summaryrefslogtreecommitdiffstats
path: root/examples/demo/qasteroids
diff options
context:
space:
mode:
Diffstat (limited to 'examples/demo/qasteroids')
-rw-r--r--examples/demo/qasteroids/ledmeter.cpp2
-rw-r--r--examples/demo/qasteroids/toplevel.cpp48
-rw-r--r--examples/demo/qasteroids/view.cpp88
-rw-r--r--examples/demo/qasteroids/view.h2
4 files changed, 70 insertions, 70 deletions
diff --git a/examples/demo/qasteroids/ledmeter.cpp b/examples/demo/qasteroids/ledmeter.cpp
index a1cfb70d1..fc2cb0013 100644
--- a/examples/demo/qasteroids/ledmeter.cpp
+++ b/examples/demo/qasteroids/ledmeter.cpp
@@ -9,7 +9,7 @@
KALedMeter::KALedMeter( TQWidget *parent ) : TQFrame( parent )
{
- mCRanges.setAutoDelete( TRUE );
+ mCRanges.setAutoDelete( true );
mRange = 100;
mCount = 20;
mCurrentCount = 0;
diff --git a/examples/demo/qasteroids/toplevel.cpp b/examples/demo/qasteroids/toplevel.cpp
index ca6db89ef..0822191f5 100644
--- a/examples/demo/qasteroids/toplevel.cpp
+++ b/examples/demo/qasteroids/toplevel.cpp
@@ -234,7 +234,7 @@ KAstTopLevel::KAstTopLevel( TQWidget *parent, const char *name )
hbd->addWidget( powerMeter );
shipsRemain = 3;
- showHiscores = FALSE;
+ showHiscores = false;
actions.insert( TQt::Key_Up, Thrust );
actions.insert( TQt::Key_Left, RotateLeft );
@@ -271,31 +271,31 @@ void KAstTopLevel::keyPressEvent( TQKeyEvent *event )
switch ( a )
{
case RotateLeft:
- view->rotateLeft( TRUE );
+ view->rotateLeft( true );
break;
case RotateRight:
- view->rotateRight( TRUE );
+ view->rotateRight( true );
break;
case Thrust:
- view->thrust( TRUE );
+ view->thrust( true );
break;
case Shoot:
- view->shoot( TRUE );
+ view->shoot( true );
break;
case Shield:
- view->setShield( TRUE );
+ view->setShield( true );
break;
case Teleport:
- view->teleport( TRUE );
+ view->teleport( true );
break;
case Brake:
- view->brake( TRUE );
+ view->brake( true );
break;
default:
@@ -318,38 +318,38 @@ void KAstTopLevel::keyReleaseEvent( TQKeyEvent *event )
switch ( a )
{
case RotateLeft:
- view->rotateLeft( FALSE );
+ view->rotateLeft( false );
break;
case RotateRight:
- view->rotateRight( FALSE );
+ view->rotateRight( false );
break;
case Thrust:
- view->thrust( FALSE );
+ view->thrust( false );
break;
case Shoot:
- view->shoot( FALSE );
+ view->shoot( false );
break;
case Brake:
- view->brake( FALSE );
+ view->brake( false );
break;
case Shield:
- view->setShield( FALSE );
+ view->setShield( false );
break;
case Teleport:
- view->teleport( FALSE );
+ view->teleport( false );
break;
case Launch:
if ( waitShip )
{
view->newShip();
- waitShip = FALSE;
+ waitShip = false;
view->hideText();
}
else
@@ -365,11 +365,11 @@ void KAstTopLevel::keyReleaseEvent( TQKeyEvent *event )
/*
case Pause:
{
- view->pause( TRUE );
+ view->pause( true );
TQMessageBox::information( this,
tr("KAsteroids is paused"),
tr("Paused") );
- view->pause( FALSE );
+ view->pause( false );
}
break;
*/
@@ -384,14 +384,14 @@ void KAstTopLevel::keyReleaseEvent( TQKeyEvent *event )
void KAstTopLevel::showEvent( TQShowEvent *e )
{
TQMainWindow::showEvent( e );
- view->pause( FALSE );
+ view->pause( false );
view->setFocus();
}
void KAstTopLevel::hideEvent( TQHideEvent *e )
{
TQMainWindow::hideEvent( e );
- view->pause( TRUE );
+ view->pause( true );
}
void KAstTopLevel::slotNewGame()
@@ -407,9 +407,9 @@ void KAstTopLevel::slotNewGame()
view->addRocks( levels[0].nrocks );
// view->showText( tr( "Press L to launch." ), yellow );
view->newShip();
- waitShip = FALSE;
+ waitShip = false;
view->hideText();
- isPaused = FALSE;
+ isPaused = false;
}
void KAstTopLevel::slotShipKilled()
@@ -421,7 +421,7 @@ void KAstTopLevel::slotShipKilled()
if ( shipsRemain )
{
- waitShip = TRUE;
+ waitShip = true;
view->showText( tr( "Ship Destroyed. Press L to launch."), yellow );
}
else
@@ -481,7 +481,7 @@ void KAstTopLevel::doStats()
.arg(r);
*/
- view->showText( "Game Over. Press N for a new game.", yellow, FALSE );
+ view->showText( "Game Over. Press N for a new game.", yellow, false );
}
void KAstTopLevel::slotUpdateVitals()
diff --git a/examples/demo/qasteroids/view.cpp b/examples/demo/qasteroids/view.cpp
index e0ee429af..b96b47384 100644
--- a/examples/demo/qasteroids/view.cpp
+++ b/examples/demo/qasteroids/view.cpp
@@ -72,11 +72,11 @@ KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name )
view.setVScrollBarMode( TQScrollView::AlwaysOff );
view.setHScrollBarMode( TQScrollView::AlwaysOff );
view.viewport()->setFocusProxy( this );
- rocks.setAutoDelete( TRUE );
- missiles.setAutoDelete( TRUE );
- bits.setAutoDelete( TRUE );
- powerups.setAutoDelete( TRUE );
- exhaust.setAutoDelete( TRUE );
+ rocks.setAutoDelete( true );
+ missiles.setAutoDelete( true );
+ bits.setAutoDelete( true );
+ powerups.setAutoDelete( true );
+ exhaust.setAutoDelete( true );
field.setBackgroundColor( black );
TQPixmap pm( IMG_BACKGROUND );
@@ -87,7 +87,7 @@ KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name )
textSprite->setFont( font );
shield = 0;
- shieldOn = FALSE;
+ shieldOn = false;
refreshRate = REFRESH_DELAY;
initialized = readSprites();
@@ -97,10 +97,10 @@ KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name )
mTimerId = -1;
shipPower = MAX_POWER_LEVEL;
- vitalsChanged = TRUE;
- can_destroy_powerups = FALSE;
+ vitalsChanged = true;
+ can_destroy_powerups = false;
- mPaused = TRUE;
+ mPaused = true;
if ( !initialized ) {
textSprite->setText( tr("Error: Cannot read sprite images") );
@@ -135,7 +135,7 @@ void KAsteroidsView::reset()
rockSpeed = 1.0;
powerupSpeed = 1.0;
mFrameNum = 0;
- mPaused = FALSE;
+ mPaused = false;
ship->hide();
shield->hide();
@@ -156,7 +156,7 @@ void KAsteroidsView::newGame()
if ( shieldOn )
{
shield->hide();
- shieldOn = FALSE;
+ shieldOn = false;
}
reset();
if ( mTimerId < 0 )
@@ -196,13 +196,13 @@ void KAsteroidsView::newShip()
shipDx = 0;
shipDy = 0;
shipAngle = 0;
- rotateL = FALSE;
- rotateR = FALSE;
- thrustShip = FALSE;
- shootShip = FALSE;
- brakeShip = FALSE;
- teleportShip = FALSE;
- shieldOn = TRUE;
+ rotateL = false;
+ rotateR = false;
+ thrustShip = false;
+ shootShip = false;
+ brakeShip = false;
+ teleportShip = false;
+ shieldOn = true;
shootDelay = 0;
shipPower = MAX_POWER_LEVEL;
rotateRate = ROTATE_RATE;
@@ -215,7 +215,7 @@ void KAsteroidsView::newShip()
ship->show();
shield->show();
mShieldCount = 1; // just in case the ship appears on a rock.
- shieldTimer->start( 1000, TRUE );
+ shieldTimer->start( 1000, true );
}
void KAsteroidsView::setShield( bool s )
@@ -238,9 +238,9 @@ void KAsteroidsView::brake( bool b )
{
if ( brakeShip && !b )
{
- rotateL = FALSE;
- rotateR = FALSE;
- thrustShip = FALSE;
+ rotateL = false;
+ rotateR = false;
+ thrustShip = false;
rotateRate = ROTATE_RATE;
}
@@ -261,7 +261,7 @@ bool KAsteroidsView::readSprites()
new TQCanvasPixmapArray( sprites_prefix + kas_animations[i].path,
kas_animations[i].frames );
if ( !anim->isValid() )
- return FALSE;
+ return false;
animation.insert( kas_animations[i].id, anim );
i++;
}
@@ -402,7 +402,7 @@ void KAsteroidsView::timerEvent( TQTimerEvent * )
if ( vitalsChanged && !(mFrameNum % 10) ) {
emit updateVitals();
- vitalsChanged = FALSE;
+ vitalsChanged = false;
}
mFrameNum++;
@@ -521,14 +521,14 @@ void KAsteroidsView::reducePower( int val )
if ( shipPower <= 0 )
{
shipPower = 0;
- thrustShip = FALSE;
+ thrustShip = false;
if ( shieldOn )
{
- shieldOn = FALSE;
+ shieldOn = false;
shield->hide();
}
}
- vitalsChanged = TRUE;
+ vitalsChanged = true;
}
void KAsteroidsView::addExhaust( double x, double y, double dx,
@@ -565,7 +565,7 @@ void KAsteroidsView::processMissiles()
wrapSprite( missile );
- TQCanvasItemList hits = missile->collisions( TRUE );
+ TQCanvasItemList hits = missile->collisions( true );
TQCanvasItemList::Iterator hit;
for ( hit = hits.begin(); hit != hits.end(); ++hit )
{
@@ -598,7 +598,7 @@ void KAsteroidsView::processShip()
shield->setFrame( (shield->frame()+1) % shield->frameCount() );
shield->move( ship->x() - 9, ship->y() - 9 );
- TQCanvasItemList hits = shield->collisions( TRUE );
+ TQCanvasItemList hits = shield->collisions( true );
TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
@@ -623,7 +623,7 @@ void KAsteroidsView::processShip()
if ( factor > mShieldCount )
{
// shield not strong enough
- shieldOn = FALSE;
+ shieldOn = false;
break;
}
rockHit( *it );
@@ -636,7 +636,7 @@ void KAsteroidsView::processShip()
if ( !shieldOn )
{
shield->hide();
- TQCanvasItemList hits = ship->collisions( TRUE );
+ TQCanvasItemList hits = ship->collisions( true );
TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
@@ -688,16 +688,16 @@ void KAsteroidsView::processShip()
if ( brakeShip )
{
- thrustShip = FALSE;
- rotateL = FALSE;
- rotateR = FALSE;
+ thrustShip = false;
+ rotateL = false;
+ rotateR = false;
rotateRate = ROTATE_RATE;
if ( fabs(shipDx) < 2.5 && fabs(shipDy) < 2.5 )
{
shipDx = 0.0;
shipDy = 0.0;
ship->setVelocity( shipDx, shipDy );
- brakeShip = FALSE;
+ brakeShip = false;
}
else
{
@@ -713,9 +713,9 @@ void KAsteroidsView::processShip()
if ( fdiff > 0.08 )
{
if ( angleDiff > 0 )
- rotateL = TRUE;
+ rotateL = true;
else if ( angleDiff < 0 )
- rotateR = TRUE;
+ rotateR = true;
if ( fdiff > 0.6 )
rotateRate = mBrakeCount + 1;
else if ( fdiff > 0.4 )
@@ -728,7 +728,7 @@ void KAsteroidsView::processShip()
}
else if ( fabs(shipDx) > 1 || fabs(shipDy) > 1 )
{
- thrustShip = TRUE;
+ thrustShip = true;
// we'll make braking a bit faster
shipDx += cosangle/6 * (mBrakeCount - 1);
shipDy += sinangle/6 * (mBrakeCount - 1);
@@ -791,7 +791,7 @@ void KAsteroidsView::processShip()
ship->move( xra, yra );
}
- vitalsChanged = TRUE;
+ vitalsChanged = true;
}
}
@@ -821,7 +821,7 @@ void KAsteroidsView::processPowerups()
wrapSprite( pup );
- TQCanvasItemList hits = pup->collisions( TRUE );
+ TQCanvasItemList hits = pup->collisions( true );
TQCanvasItemList::Iterator it;
for ( it = hits.begin(); it != hits.end(); ++it )
{
@@ -852,7 +852,7 @@ void KAsteroidsView::processPowerups()
}
powerups.removeRef( pup );
- vitalsChanged = TRUE;
+ vitalsChanged = true;
}
else if ( (*it) == shield )
{
@@ -876,7 +876,7 @@ void KAsteroidsView::hideShield()
{
shield->hide();
mShieldCount = 0;
- shieldOn = FALSE;
+ shieldOn = false;
}
double KAsteroidsView::randDouble()
@@ -893,10 +893,10 @@ int KAsteroidsView::randInt( int range )
void KAsteroidsView::showEvent( TQShowEvent *e )
{
#if defined( QT_LICENSE_PROFESSIONAL )
- static bool wasThere = FALSE;
+ static bool wasThere = false;
if ( !wasThere ) {
- wasThere = TRUE;
+ wasThere = true;
TQMessageBox::information( this, tr("TQCanvas demo"),
tr("This game has been implemented using the TQCanvas class.\n"
"The TQCanvas class is not part of the Professional Edition. Please \n"
diff --git a/examples/demo/qasteroids/view.h b/examples/demo/qasteroids/view.h
index d54fa847a..f7c1ce802 100644
--- a/examples/demo/qasteroids/view.h
+++ b/examples/demo/qasteroids/view.h
@@ -41,7 +41,7 @@ public:
void brake( bool b );
void pause( bool p);
- void showText( const TQString &text, const TQColor &color, bool scroll=TRUE );
+ void showText( const TQString &text, const TQColor &color, bool scroll=true );
void hideText();
int shots() const { return shotsFired; }