diff options
Diffstat (limited to 'kasteroids/view.cpp')
-rw-r--r-- | kasteroids/view.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/kasteroids/view.cpp b/kasteroids/view.cpp index 8ca358fd..e203ffb5 100644 --- a/kasteroids/view.cpp +++ b/kasteroids/view.cpp @@ -63,13 +63,13 @@ kas_animations [] = -KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) - : QWidget( parent, name ), +KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name ) + : TQWidget( parent, name ), field(640, 440), view(&field,this) { - view.setVScrollBarMode( QScrollView::AlwaysOff ); - view.setHScrollBarMode( QScrollView::AlwaysOff ); + view.setVScrollBarMode( TQScrollView::AlwaysOff ); + view.setHScrollBarMode( TQScrollView::AlwaysOff ); rocks.setAutoDelete( true ); missiles.setAutoDelete( true ); bits.setAutoDelete( true ); @@ -77,11 +77,11 @@ KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) exhaust.setAutoDelete( true ); field.setBackgroundColor(black); - QPixmap pm( locate("sprite", IMG_BACKGROUND) ); + TQPixmap pm( locate("sprite", IMG_BACKGROUND) ); field.setBackgroundPixmap( pm ); - textSprite = new QCanvasText( &field ); - QFont font( KGlobalSettings::generalFont().family(), 18 ); + textSprite = new TQCanvasText( &field ); + TQFont font( KGlobalSettings::generalFont().family(), 18 ); textSprite->setFont( font ); shield = 0; @@ -90,8 +90,8 @@ KAsteroidsView::KAsteroidsView( QWidget *parent, const char *name ) readSprites(); - shieldTimer = new QTimer( this ); - connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) ); + shieldTimer = new TQTimer( this ); + connect( shieldTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(hideShield()) ); mTimerId = -1; shipPower = MAX_POWER_LEVEL; @@ -229,19 +229,19 @@ void KAsteroidsView::brake( bool b ) void KAsteroidsView::readSprites() { - QString sprites_prefix = + TQString sprites_prefix = KGlobal::dirs()->findResourceDir("sprite", "rock1/rock10000.png"); int i = 0; while ( kas_animations[i].id ) { animation.insert( kas_animations[i].id, - new QCanvasPixmapArray( sprites_prefix + kas_animations[i].path, + new TQCanvasPixmapArray( sprites_prefix + kas_animations[i].path, kas_animations[i].frames ) ); i++; } - ship = new QCanvasSprite( animation[ID_SHIP], &field ); + ship = new TQCanvasSprite( animation[ID_SHIP], &field ); ship->hide(); shield = new KShield( animation[ID_SHIELD], &field ); @@ -282,7 +282,7 @@ void KAsteroidsView::addRocks( int num ) // - - - -void KAsteroidsView::showText( const QString &text, const QColor &color, bool scroll ) +void KAsteroidsView::showText( const TQString &text, const TQColor &color, bool scroll ) { // textSprite->setTextFlags( AlignHCenter | AlignVCenter ); textSprite->setText( text ); @@ -309,20 +309,20 @@ void KAsteroidsView::hideText() // - - - -void KAsteroidsView::resizeEvent(QResizeEvent* event) +void KAsteroidsView::resizeEvent(TQResizeEvent* event) { - QWidget::resizeEvent(event); + TQWidget::resizeEvent(event); field.resize(width()-4, height()-4); view.resize(width(),height()); } // - - - -void KAsteroidsView::timerEvent( QTimerEvent * ) +void KAsteroidsView::timerEvent( TQTimerEvent * ) { field.advance(); - QCanvasSprite *rock; + TQCanvasSprite *rock; // move rocks forward for ( rock = rocks.first(); rock; rock = rocks.next() ) { @@ -380,7 +380,7 @@ void KAsteroidsView::timerEvent( QTimerEvent * ) mFrameNum++; } -void KAsteroidsView::wrapSprite( QCanvasItem *s ) +void KAsteroidsView::wrapSprite( TQCanvasItem *s ) { int x = int(s->x() + s->boundingRect().width() / 2); int y = int(s->y() + s->boundingRect().height() / 2); @@ -398,7 +398,7 @@ void KAsteroidsView::wrapSprite( QCanvasItem *s ) // - - - -void KAsteroidsView::rockHit( QCanvasItem *hit ) +void KAsteroidsView::rockHit( TQCanvasItem *hit ) { KPowerup *nPup = 0; int rnd = static_cast<int>(krandom.getDouble()*30.0) % 30; @@ -455,7 +455,7 @@ void KAsteroidsView::rockHit( QCanvasItem *hit ) else if ( dy < -maxRockSpeed ) dy = -maxRockSpeed; - QCanvasSprite *nrock; + TQCanvasSprite *nrock; for ( int i = 0; i < 4; i++ ) { @@ -484,7 +484,7 @@ void KAsteroidsView::rockHit( QCanvasItem *hit ) } else if ( hit->rtti() == ID_ROCK_SMALL ) emit rockHit( 2 ); - rocks.removeRef( (QCanvasSprite *)hit ); + rocks.removeRef( (TQCanvasSprite *)hit ); if ( rocks.count() == 0 ) emit rocksRemoved(); } @@ -524,7 +524,7 @@ void KAsteroidsView::processMissiles() // if a missile has hit a rock, remove missile and break rock into smaller // rocks or remove completely. - QPtrListIterator<KMissile> it(missiles); + TQPtrListIterator<KMissile> it(missiles); for ( ; it.current(); ++it ) { @@ -539,8 +539,8 @@ void KAsteroidsView::processMissiles() wrapSprite( missile ); - QCanvasItemList hits = missile->collisions( true ); - QCanvasItemList::Iterator hit; + TQCanvasItemList hits = missile->collisions( true ); + TQCanvasItemList::Iterator hit; for ( hit = hits.begin(); hit != hits.end(); ++hit ) { if ( (*hit)->rtti() >= ID_ROCK_LARGE && @@ -572,8 +572,8 @@ void KAsteroidsView::processShip() shield->setFrame( (shield->frame()+1) % shield->frameCount() ); shield->move( ship->x() - 9, ship->y() - 9 ); - QCanvasItemList hits = shield->collisions( true ); - QCanvasItemList::Iterator it; + TQCanvasItemList hits = shield->collisions( true ); + TQCanvasItemList::Iterator it; for ( it = hits.begin(); it != hits.end(); ++it ) { if ( (*it)->rtti() >= ID_ROCK_LARGE && @@ -610,8 +610,8 @@ void KAsteroidsView::processShip() if ( !shieldOn ) { shield->hide(); - QCanvasItemList hits = ship->collisions( true ); - QCanvasItemList::Iterator it; + TQCanvasItemList hits = ship->collisions( true ); + TQCanvasItemList::Iterator it; for ( it = hits.begin(); it != hits.end(); ++it ) { if ( (*it)->rtti() >= ID_ROCK_LARGE && @@ -780,7 +780,7 @@ void KAsteroidsView::processPowerups() // destroy it KPowerup *pup; - QPtrListIterator<KPowerup> it( powerups ); + TQPtrListIterator<KPowerup> it( powerups ); for( ; (pup = it.current()); ) { @@ -795,8 +795,8 @@ void KAsteroidsView::processPowerups() wrapSprite( pup ); - QCanvasItemList hits = pup->collisions( true ); - QCanvasItemList::Iterator it; + TQCanvasItemList hits = pup->collisions( true ); + TQCanvasItemList::Iterator it; for ( it = hits.begin(); it != hits.end(); ++it ) { if ( (*it) == ship || (*it) == shield ) |