From ea318d1431c89e647598c510c4245c6571aa5f46 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 26 Jan 2012 23:32:43 -0600 Subject: Update to latest tqt3 automated conversion --- doc/html/t11-cannon-cpp.html | 96 ++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'doc/html/t11-cannon-cpp.html') diff --git a/doc/html/t11-cannon-cpp.html b/doc/html/t11-cannon-cpp.html index bd2f1f4ea..eeb1104f6 100644 --- a/doc/html/t11-cannon-cpp.html +++ b/doc/html/t11-cannon-cpp.html @@ -39,25 +39,25 @@ body { background: #ffffff; color: black; } ****************************************************************/ #include "cannon.h" -#include <qtimer.h> -#include <qpainter.h> -#include <qpixmap.h> +#include <ntqtimer.h> +#include <ntqpainter.h> +#include <ntqpixmap.h> #include <math.h> -CannonField::CannonField( TQWidget *parent, const char *name ) - : TQWidget( parent, name ) +CannonField::CannonField( TQWidget *parent, const char *name ) + : TQWidget( parent, name ) { ang = 45; f = 0; timerCount = 0; - autoShootTimer = new TQTimer( this, "movement handler" ); - connect( autoShootTimer, SIGNAL(timeout()), + autoShootTimer = new TQTimer( this, "movement handler" ); + connect( autoShootTimer, SIGNAL(timeout()), this, SLOT(moveShot()) ); shoot_ang = 0; shoot_f = 0; - setPalette( TQPalette( TQColor( 250, 250, 200) ) ); + setPalette( TQPalette( TQColor( 250, 250, 200) ) ); } @@ -70,7 +70,7 @@ void CannonField::setAngle( int degrees ) if ( ang == degrees ) return; ang = degrees; - repaint( cannonRect(), FALSE ); + repaint( cannonRect(), FALSE ); emit angleChanged( ang ); } @@ -88,77 +88,77 @@ void CannonField::setForce( int newton ) void CannonField::shoot() { - if ( autoShootTimer->isActive() ) + if ( autoShootTimer->isActive() ) return; timerCount = 0; shoot_ang = ang; shoot_f = f; - autoShootTimer->start( 50 ); + autoShootTimer->start( 50 ); } void CannonField::moveShot() { - TQRegion r( shotRect() ); + TQRegion r( shotRect() ); timerCount++; - TQRect shotR = shotRect(); + TQRect shotR = shotRect(); - if ( shotR.x() > width() || shotR.y() > height() ) - autoShootTimer->stop(); + if ( shotR.x() > width() || shotR.y() > height() ) + autoShootTimer->stop(); else - r = r.unite( TQRegion( shotR ) ); - repaint( r ); + r = r.unite( TQRegion( shotR ) ); + repaint( r ); } -void CannonField::paintEvent( TQPaintEvent *e ) +void CannonField::paintEvent( TQPaintEvent *e ) { - TQRect updateR = e->rect(); - TQPainter p( this ); + TQRect updateR = e->rect(); + TQPainter p( this ); - if ( updateR.intersects( cannonRect() ) ) + if ( updateR.intersects( cannonRect() ) ) paintCannon( &p ); - if ( autoShootTimer->isActive() && - updateR.intersects( shotRect() ) ) + if ( autoShootTimer->isActive() && + updateR.intersects( shotRect() ) ) paintShot( &p ); } -void CannonField::paintShot( TQPainter *p ) +void CannonField::paintShot( TQPainter *p ) { - p->setBrush( black ); - p->setPen( NoPen ); - p->drawRect( shotRect() ); + p->setBrush( black ); + p->setPen( NoPen ); + p->drawRect( shotRect() ); } -const TQRect barrelRect(33, -4, 15, 8); +const TQRect barrelRect(33, -4, 15, 8); -void CannonField::paintCannon( TQPainter *p ) +void CannonField::paintCannon( TQPainter *p ) { - TQRect cr = cannonRect(); - TQPixmap pix( cr.size() ); - pix.fill( this, cr.topLeft() ); + TQRect cr = cannonRect(); + TQPixmap pix( cr.size() ); + pix.fill( this, cr.topLeft() ); - TQPainter tmp( &pix ); - tmp.setBrush( blue ); - tmp.setPen( NoPen ); + TQPainter tmp( &pix ); + tmp.setBrush( blue ); + tmp.setPen( NoPen ); - tmp.translate( 0, pix.height() - 1 ); - tmp.drawPie( TQRect( -35,-35, 70, 70 ), 0, 90*16 ); - tmp.rotate( -ang ); - tmp.drawRect( barrelRect ); - tmp.end(); + tmp.translate( 0, pix.height() - 1 ); + tmp.drawPie( TQRect( -35,-35, 70, 70 ), 0, 90*16 ); + tmp.rotate( -ang ); + tmp.drawRect( barrelRect ); + tmp.end(); - p->drawPixmap( cr.topLeft(), pix ); + p->drawPixmap( cr.topLeft(), pix ); } TQRect CannonField::cannonRect() const { - TQRect r( 0, 0, 50, 50 ); - r.moveBottomLeft( rect().bottomLeft() ); + TQRect r( 0, 0, 50, 50 ); + r.moveBottomLeft( rect().bottomLeft() ); return r; } @@ -173,18 +173,18 @@ TQRect CannonField::shotRect() const double velx = velocity*cos( radians ); double vely = velocity*sin( radians ); - double x0 = ( barrelRect.right() + 5 )*cos(radians); - double y0 = ( barrelRect.right() + 5 )*sin(radians); + double x0 = ( barrelRect.right() + 5 )*cos(radians); + double y0 = ( barrelRect.right() + 5 )*sin(radians); double x = x0 + velx*time; double y = y0 + vely*time - 0.5*gravity*time*time; - TQRect r = TQRect( 0, 0, 6, 6 ); - r.moveCenter( TQPoint( qRound(x), height() - 1 - qRound(y) ) ); + TQRect r = TQRect( 0, 0, 6, 6 ); + r.moveCenter( TQPoint( qRound(x), height() - 1 - qRound(y) ) ); return r; } -TQSizePolicy CannonField::sizePolicy() const +TQSizePolicy CannonField::sizePolicy() const { return TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ); } -- cgit v1.2.1